public Word(int byteCount) : this(byteCount, Signs.Positive) { for (int i = 0; i < byteCount; i++) { mBytes[i] = new MixByte(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; }
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); }
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(); } }
public static bool IsValidFieldSpec(MixByte value) => IsValidFieldSpec(value / 8, value % 8);
public FieldSpec(MixByte value) { MixByteValue = value; }