aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/lunixbochs/struc/field.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/lunixbochs/struc/field.go')
-rw-r--r--vendor/github.com/lunixbochs/struc/field.go16
1 files changed, 12 insertions, 4 deletions
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 {