Пример #1
0
 public static BitsConst Multiply(BitsConst left, int right) => left * Convert(right);
Пример #2
0
 public BitsArrayValue(BitsConst data) { _data = data; }
Пример #3
0
 public BitsConst Slash(BitsConst right, Size size) => Divide(right, size);
Пример #4
0
 public BitsStackData(BitsConst data, IOutStream outStream)
     : base(outStream)
 {
     _data = data;
     Tracer.Assert(!_data.Size.IsZero);
 }
Пример #5
0
 static BitsConst Paste(BitsConst bitsConst, NonListStackData data)
     => bitsConst.Concat(data.GetBitsConst());
Пример #6
0
 public static BitsConst Divide(BitsConst left, int right) => left / Convert(right);
Пример #7
0
 internal BitsConst BitArrayBinaryOp(string operation, Size size, BitsConst right)
 {
     var methodInfo = typeof(BitsConst).GetMethod(operation);
     if(methodInfo == null)
         throw new MissingMethodException(operation);
     return (BitsConst) methodInfo.Invoke(this, new object[] {right, size});
 }
Пример #8
0
 public BitsConst LessEqual(BitsConst right, Size size)
     => ToBitsConst(AsInteger <= right.AsInteger, size);
Пример #9
0
 public BitsConst LessGreater(BitsConst right, Size size)
     => ToBitsConst(AsInteger != right.AsInteger, size);
Пример #10
0
 public BitsConst Minus(BitsConst right, Size size) => Plus(right * -1, size);
Пример #11
0
 public BitsConst GreaterEqual(BitsConst right, Size size)
     => ToBitsConst(AsInteger >= right.AsInteger, size);
Пример #12
0
 public BitsConst Plus(BitsConst right, Size size)
 {
     var xResult = new BitsConst(this, size);
     var yResult = new BitsConst(right, size);
     xResult.AddAndKeepSize(yResult);
     return xResult;
 }
Пример #13
0
 public BitsConst BytePlus(BitsConst left, int bytes) => Plus(left, SegmentBits * bytes);
Пример #14
0
 public BitsConst Divide(BitsConst right, Size size)
 {
     if(!(Marshal.SizeOf(typeof(long)) * 8 >= size.ToInt()))
         Tracer.AssertionFailed
             (
                 @"sizeof(Int64)*8 >= size.ToInt()",
                 () => "right=" + right + ";size=" + size.Dump());
     return Convert(ToInt64() / right.ToInt64()).Resize(size);
 }
Пример #15
0
 BitsConst(BitsConst value, Size size)
     : this(size)
 {
     MoveData(_data, Size, value._data, value.Size);
 }
Пример #16
0
 public BitsConst Concat(BitsConst other)
 {
     Size.AssertAlignedSize(SegmentAlignBits);
     var result = new BitsConst(Size + other.Size);
     DataHandler.MoveBytes(DataSize(Size), result._data, 0, _data, 0);
     DataHandler.MoveBytes
         (DataSize(other.Size), result._data, DataSize(Size), other._data, 0);
     return result;
 }
Пример #17
0
 public static BitsConst Divide(BitsConst left, BitsConst right)
     => left.Divide(right, DivideSize(left.Size, right.Size));
Пример #18
0
        public void PrintNumber(BitsConst radix, IOutStream outStream)
        {
            var r = radix.ToInt64();
            if(radix.Size.IsZero)
                r = 10;
            var left = ToString((int) r);

            outStream.AddData(left);
        }
Пример #19
0
 void AddAndKeepSize(BitsConst left)
 {
     short carry = 0;
     for(var i = 0; i < _data.Length; i++)
     {
         carry += _data[i];
         carry += left._data[i];
         _data[i] = (byte) carry;
         carry /= (short) SegmentValues;
     }
     return;
 }
Пример #20
0
 public static BitsConst Add(BitsConst left, BitsConst right)
     => left.Plus(right, PlusSize(left.Size, right.Size));
Пример #21
0
 void IVisitor.BitsArray(Size size, BitsConst data)
 {
     if(size.IsZero)
         return;
     Push(new BitsStackData(data.Resize(size), _context.OutStream));
 }
Пример #22
0
 public static BitsConst Subtract(BitsConst left, BitsConst right)
     => left.Plus(right * -1, PlusSize(left.Size, right.Size));
Пример #23
0
 void IVisitor.BitsArray(Size size, BitsConst data)
     => AddCode("data.SizedPush({0}{1})", size.ByteCount, data.ByteSequence());
Пример #24
0
 public static BitsConst Subtract(int left, BitsConst right) => Convert(left) - right;
Пример #25
0
 void IVisitor.BitsArray(Size size, BitsConst data)
 {
     var startAddress = (_startAddress - size).ToInt();
     var element = FormalValueAccess.BitsArray(data);
     SetFormalValues(element, startAddress, size);
 }
Пример #26
0
 public static BitsConst Multiply(BitsConst left, BitsConst right)
     => left.Multiply(right, MultiplySize(left.Size, right.Size));
Пример #27
0
 public static IFormalValue BitsArray(BitsConst data) => new BitsArrayValue(data);
Пример #28
0
 public BitsConst Star(BitsConst right, Size size) => Multiply(right, size);