aboutsummaryrefslogtreecommitdiff
path: root/ber/len.go
diff options
context:
space:
mode:
Diffstat (limited to 'ber/len.go')
-rw-r--r--ber/len.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/ber/len.go b/ber/len.go
index e1d7933..52bae63 100644
--- a/ber/len.go
+++ b/ber/len.go
@@ -23,9 +23,10 @@ func MarshalLen(i int) (b []byte) {
if i < 0x80 {
return []byte{byte(i)}
}
- for n := lenLen(i); n > 0; n-- {
+ n := lenLen(i)
+ b = append(b, byte(n)|0x80)
+ for ; n > 0; n-- {
b = append(b, byte(i>>uint((n-1)*8)))
}
- b = append([]byte{byte(len(b) | 0x80)}, b...)
return
}