コード例 #1
0
 public void WriteAsHex(byte data)
 {
     this.ValidateCapacity(2);
     this.segment.Array[this.segment.Offset + this.end] = ByteArrayWriter.GetLowerHexChar((byte)(data >> 4));
     this.end++;
     this.segment.Array[this.segment.Offset + this.end] = ByteArrayWriter.GetLowerHexChar(data & 15);
     this.end++;
 }
コード例 #2
0
 public void WriteAsHex(ArraySegment <byte> data)
 {
     this.ValidateCapacity(data.Count * 2);
     for (int i = 0; i < data.Count; i++)
     {
         this.segment.Array[this.segment.Offset + this.end] = ByteArrayWriter.GetLowerHexChar((byte)(data.Array[data.Offset + i] >> 4));
         this.end++;
         this.segment.Array[this.segment.Offset + this.end] = ByteArrayWriter.GetLowerHexChar(data.Array[data.Offset + i] & 15);
         this.end++;
     }
 }
コード例 #3
0
        public void WriteAsHex8(int value)
        {
            this.ValidateCapacity(8);
            this.end += 8;
            int i = 1;

            while (i < 9)
            {
                this.segment.Array[this.segment.Offset + this.end - i] = ByteArrayWriter.GetLowerHexChar((byte)(value & 15));
                i++;
                value >>= 4;
            }
        }