|
|
@@ -210,10 +210,9 @@ func (e *msgpackEncDriver) EncodeNil() {
|
|
|
}
|
|
|
|
|
|
func (e *msgpackEncDriver) EncodeInt(i int64) {
|
|
|
- // if i >= 0 {
|
|
|
- // e.EncodeUint(uint64(i))
|
|
|
- // } else if false &&
|
|
|
- if i > math.MaxInt8 {
|
|
|
+ if e.h.PositiveIntUnsigned && i >= 0 {
|
|
|
+ e.EncodeUint(uint64(i))
|
|
|
+ } else if i > math.MaxInt8 {
|
|
|
if i <= math.MaxInt16 {
|
|
|
e.w.writen1(mpInt16)
|
|
|
bigenHelper{e.x[:2], e.w}.writeUint16(uint16(i))
|
|
|
@@ -942,6 +941,9 @@ type MsgpackHandle struct {
|
|
|
// a []byte or string based on the setting of RawToString.
|
|
|
WriteExt bool
|
|
|
|
|
|
+ // PositiveIntUnsigned says to encode positive integers as unsigned.
|
|
|
+ PositiveIntUnsigned bool
|
|
|
+
|
|
|
binaryEncodingType
|
|
|
noElemSeparators
|
|
|
|