Commit 9112562f authored by Damian Gryski's avatar Damian Gryski

encoder: oops, uint16s are little-endian too

parent ea2098b7
...@@ -135,7 +135,7 @@ func (e *Encoder) encodeInt(k reflect.Kind, i int64) { ...@@ -135,7 +135,7 @@ func (e *Encoder) encodeInt(k reflect.Kind, i int64) {
case i > 0 && i < math.MaxUint8: case i > 0 && i < math.MaxUint8:
e.w.Write([]byte{opBinint1, byte(i)}) e.w.Write([]byte{opBinint1, byte(i)})
case i > 0 && i < math.MaxUint16: case i > 0 && i < math.MaxUint16:
e.w.Write([]byte{opBinint2, byte(i >> 8), byte(i)}) e.w.Write([]byte{opBinint2, byte(i), byte(i >> 8)})
case i >= math.MinInt32 && i <= math.MaxInt32: case i >= math.MinInt32 && i <= math.MaxInt32:
e.w.Write([]byte{opBinint}) e.w.Write([]byte{opBinint})
binary.Write(e.w, binary.LittleEndian, int32(i)) binary.Write(e.w, binary.LittleEndian, int32(i))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment