Read a big-endian uint32 from a byte span at offset. Returns 0 and sets ok=false if out of bounds.
| 7 | // Read a big-endian uint32 from a byte span at offset. |
| 8 | // Returns 0 and sets ok=false if out of bounds. |
| 9 | inline fl::u32 readU32BE(fl::span<const fl::u8> data, fl::size offset, bool& ok) { |
| 10 | if (offset + 4 > data.size()) { ok = false; return 0; } |
| 11 | return (fl::u32(data[offset]) << 24) | |
| 12 | (fl::u32(data[offset + 1]) << 16) | |
| 13 | (fl::u32(data[offset + 2]) << 8) | |
| 14 | fl::u32(data[offset + 3]); |
| 15 | } |
| 16 | |
| 17 | inline fl::u16 readU16BE(fl::span<const fl::u8> data, fl::size offset, bool& ok) { |
| 18 | if (offset + 2 > data.size()) { ok = false; return 0; } |
no test coverage detected