WriteLengthAndMagic just writes length and magic as uint32 4 byte values into the given array.
(bytes []byte, length int, magic uint32)
| 8 | |
| 9 | //WriteLengthAndMagic just writes length and magic as uint32 4 byte values into the given array. |
| 10 | func WriteLengthAndMagic(bytes []byte, length int, magic uint32) { |
| 11 | binary.LittleEndian.PutUint32(bytes, uint32(length)) |
| 12 | binary.LittleEndian.PutUint32(bytes[4:], magic) |
| 13 | } |
| 14 | |
| 15 | //ParseLengthAndMagic checks if if the given byte array is longer or equal the uint32 in the first 4 bytes, and if the magic value in the second 4 bytes equals the supplied magic |
| 16 | // and returns the length, a slice of the bytes without length and magic or an error. |
no outgoing calls
no test coverage detected