appendForEncoding appends the |value| to the specified |bytes| and returns the updated byte slice. If |largeEncoding| is true, then 4 bytes are added to |bytes| to represent |value|, otherwise 2 bytes are used. This is a helper function for serializing the smallArray/largeArray and smallObject/large
(bytes []byte, value uint32, largeEncoding bool)
| 293 | // This is a helper function for serializing the smallArray/largeArray and smallObject/largeObject formats, since |
| 294 | // they are identical formats, except that offsets, counts, and sizes are stored as 2 bytes in the small encodings, |
| 295 | // and stored as 4 bytes in the large encodings. |
| 296 | func appendForEncoding(bytes []byte, value uint32, largeEncoding bool) []byte { |
| 297 | if !largeEncoding { |
| 298 | bytes = append(bytes, byte(value), byte(value>>8)) |
| 299 | } else { |
| 300 | bytes = append(bytes, byte(value), byte(value>>8), byte(value>>16), byte(value>>24)) |
| 301 | } |
| 302 | return bytes |
| 303 | } |
| 304 | |
| 305 | // appendStringLength appends a variable number of bytes to the specified |bytes| to encode |length|, the |
no outgoing calls
no test coverage detected