1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package uleb128 6 7 func AppendUleb128(b []byte, v uint) []byte { 8 for { 9 c := uint8(v & 0x7f) 10 v >>= 7 11 if v != 0 { 12 c |= 0x80 13 } 14 b = append(b, c) 15 if c&0x80 == 0 { 16 break 17 } 18 } 19 return b 20 } 21