MCPcopy Create free account
hub / github.com/Monibuca/engine / writeU29

Method writeU29

util/amf3.go:145–159  ·  view source on GitHub ↗
(value uint32)

Source from the content-addressed store, hash-verified

143 return ret, nil
144}
145func (amf *AMF3) writeU29(value uint32) error {
146 switch {
147 case value < 0x80:
148 amf.WriteByte(byte(value))
149 case value < 0x4000:
150 amf.Write([]byte{byte((value >> 7) | 0x80), byte(value & 0x7f)})
151 case value < 0x200000:
152 amf.Write([]byte{byte((value >> 14) | 0x80), byte((value >> 7) | 0x80), byte(value & 0x7f)})
153 case value < 0x20000000:
154 amf.Write([]byte{byte((value >> 22) | 0x80), byte((value >> 15) | 0x80), byte((value >> 7) | 0x80), byte(value & 0xff)})
155 default:
156 return errors.New("u29 over flow")
157 }
158 return nil
159}
160
161func (amf *AMF3) Marshals(v ...any) []byte {
162 for _, vv := range v {

Callers 2

writeStringMethod · 0.95
MarshalMethod · 0.95

Calls 3

NewMethod · 0.80
WriteByteMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected