(value uint32)
| 143 | return ret, nil |
| 144 | } |
| 145 | func (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 | |
| 161 | func (amf *AMF3) Marshals(v ...any) []byte { |
| 162 | for _, vv := range v { |
no test coverage detected