Ejemplo n.º 1
0
        public virtual void Encode(ulong v, StringBuilder sb)
        {
            // by default, we just treat a 64-bit group as a sequence of bytes.
            var bytes = BitConverter.GetBytes(v.ByteSwap());

            Encode(bytes, 0, bytes.Length, sb);
        }
Ejemplo n.º 2
0
        public BigInt(ulong v)
        {
            var x = v.ByteSwap();

            this._num       = new[] { (uint)(x >> 32), (uint)x };
            this._byteCount = 8;
        }
Ejemplo n.º 3
0
 public static ulong NetworkToHostOrder(this ulong value)
 {
     if (BitConverter.IsLittleEndian)
     {
         return(value.ByteSwap());
     }
     return(value);
 }
Ejemplo n.º 4
0
        public static void Write(this BinaryWriter writer, ulong value, bool isLittleEndian)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.Write(!isLittleEndian ? value.ByteSwap() : value);
        }
Ejemplo n.º 5
0
        public static ulong ReadUInt64(this BinaryReader reader, bool isLittleEndian)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            ulong value = reader.ReadUInt64();

            return(!isLittleEndian?value.ByteSwap() : value);
        }