public void ToBytesSink(IBytesSink to) { UInt64 man = Mantissa(); if (IsNative) { if (!IsNegative) { man = man.Or(BinaryFlagIsNonNegativeNative); } to.Add(man.ToByteArray()); } else { int offset = Offset; UInt64 packed; if (IsZero) { packed = BinaryFlagIsIou; } else if (IsNegative) { packed = man.Or(new UInt64(((long)512 + 0 + 97 + offset)).ShiftLeft(64 - 10)); } else { packed = man.Or(new UInt64(((long)512 + 256 + 97 + offset)).ShiftLeft(64 - 10)); } to.Add(packed.ToByteArray()); to.Add(_currency.Bytes); to.Add(_issuer.Bytes); } }
public UInt64 Mantissa() { return(_mantissa ?? (_mantissa = CalculateMantissa())); }