/// <summary>
 /// Вычисляет значения двух- и четырехбайтных переменных заводских установок на основе
 /// значений однобайтных переменных для указанного проекта
 /// </summary>
 private void ComputeMultibyteEmbeddedVarsValues(ControllerProgramSolution solution)
 {
     for (int count = 2; count < 5; count += 2)
     {
         string s = (count == 2) ? "i" : "l";
         for (char c = 'W'; c <= 'Z'; c++)
         {
             for (int i = 0; i < 16; i += count)
             {
                 byte[] bytes = new byte[count];
                 for (int j = 0; j < count; j++)
                 {
                     bytes[j] = (byte)solution.Vars.GetEmbeddedVar(c.ToString() + (i + j)).Value;
                 }
                 if (solution.ProcessorParams.InverseByteOrder)
                 {
                     bytes = Utils.ReflectArray <byte>(bytes);
                 }
                 solution.Vars.GetEmbeddedVar(c.ToString() + i + s).Value = AppliedMath.BytesToLong(bytes);
             }
         }
         for (int i = 0; i < 64; i += count)
         {
             byte[] bytes = new byte[count];
             for (int j = 0; j < count; j++)
             {
                 bytes[j] = (byte)solution.Vars.GetEmbeddedVar("EE" + (i + j)).Value;
             }
             if (solution.ProcessorParams.InverseByteOrder)
             {
                 bytes = Utils.ReflectArray <byte>(bytes);
             }
             solution.Vars.GetEmbeddedVar("EE" + i + s).Value = AppliedMath.BytesToLong(bytes);
         }
     }
 }
Example #2
0
 /// <summary>
 /// Восстанавливает число по байтам, его составляющим; байты начинаются со старшего
 /// </summary>
 public static int BytesToInt(byte[] Bytes)
 {
     return((int)AppliedMath.BytesToLong(Bytes));
 }