diff options
Diffstat (limited to 'ber/len.go')
-rw-r--r-- | ber/len.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 } |