aboutsummaryrefslogtreecommitdiff
path: root/ber/int.go
diff options
context:
space:
mode:
Diffstat (limited to 'ber/int.go')
-rw-r--r--ber/int.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/ber/int.go b/ber/int.go
index 41defc8..a29e7dd 100644
--- a/ber/int.go
+++ b/ber/int.go
@@ -2,11 +2,12 @@ package ber
func UnmarshalInt(b []byte) (i int) {
neg := b[0]&0x80 != 0
- for n, v := range b {
+ for _, v := range b {
if neg {
v = ^v
}
- i += int(v) << uint((len(b)-n-1)*8)
+ i <<= 8
+ i |= int(v)
}
if neg {
i = ^i