X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vendor%2Fgithub.com%2Flunixbochs%2Fstruc%2Ffield.go;h=6e59c2abcb8679034032462fc139cf2d95e3b799;hb=08266e35878f198e2fa59fcfc9f0fc3a4b1dfbf5;hp=5ab7da61796d7fec29804bd78dd13cac66f5a1b7;hpb=3ef6f210edcf7dd753733d46ec3f2dd5dc795b61;p=govpp.git diff --git a/vendor/github.com/lunixbochs/struc/field.go b/vendor/github.com/lunixbochs/struc/field.go index 5ab7da6..6e59c2a 100644 --- a/vendor/github.com/lunixbochs/struc/field.go +++ b/vendor/github.com/lunixbochs/struc/field.go @@ -222,13 +222,21 @@ func (f *Field) unpackVal(buf []byte, val reflect.Value, length int, options *Op case Bool, Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64: var n uint64 switch typ { - case Bool, Int8, Uint8: + case Int8: + n = uint64(int64(int8(buf[0]))) + case Int16: + n = uint64(int64(int16(order.Uint16(buf)))) + case Int32: + n = uint64(int64(int32(order.Uint32(buf)))) + case Int64: + n = uint64(int64(order.Uint64(buf))) + case Bool, Uint8: n = uint64(buf[0]) - case Int16, Uint16: + case Uint16: n = uint64(order.Uint16(buf)) - case Int32, Uint32: + case Uint32: n = uint64(order.Uint32(buf)) - case Int64, Uint64: + case Uint64: n = uint64(order.Uint64(buf)) } switch f.kind {