Ejemplo n.º 1
0
 public Word(int byteCount) : this(byteCount, Signs.Positive)
 {
     for (int i = 0; i < byteCount; i++)
     {
         mBytes[i] = new MixByte(0);
     }
 }
Ejemplo n.º 2
0
        public FieldSpec(int lowBound, int highBound)
        {
            if (!IsValidFieldSpec(lowBound, highBound))
            {
                throw new ArgumentException("low and/or high bounds are invalid");
            }

            MixByteValue = (8 * lowBound) + highBound;
        }
Ejemplo n.º 3
0
        long SetMagnitudeLongValue(long magnitude)
        {
            long oldValue = MagnitudeLongValue;

            magnitude = magnitude.GetMagnitude();

            if (oldValue == magnitude)
            {
                return(magnitude);
            }

            for (int i = ByteCount - 1; i >= 0; i--)
            {
                mBytes[i] = new MixByte((byte)(magnitude & MixByte.MaxValue));
                magnitude = magnitude >> MixByte.BitCount;
            }

            return(oldValue);
        }
Ejemplo n.º 4
0
        public MixByte this[int index]
        {
            get
            {
                MixByte selectedByte;

                mAccessLock.AcquireReaderLock(Timeout.Infinite);

                try
                {
                    selectedByte = mBytes[index];
                }
                finally
                {
                    mAccessLock.ReleaseReaderLock();
                }

                return(selectedByte);
            }
            set
            {
                mAccessLock.AcquireWriterLock(Timeout.Infinite);

                try
                {
                    MixByte oldValue = mBytes[index];

                    mBytes[index] = value ?? new MixByte();

                    if (oldValue.ByteValue == mBytes[index].ByteValue)
                    {
                        return;
                    }
                }
                finally
                {
                    mAccessLock.ReleaseWriterLock();
                }

                OnWordValueChanged();
            }
        }
Ejemplo n.º 5
0
 public static bool IsValidFieldSpec(MixByte value) => IsValidFieldSpec(value / 8, value % 8);
Ejemplo n.º 6
0
 public FieldSpec(MixByte value)
 {
     MixByteValue = value;
 }