Add buffer_write64be()
Add a function to write 64 bits in big-endian from a uint64_t.
This commit is contained in:
parent
1f8ba1ca79
commit
810ff80ba7
1 changed files with 6 additions and 0 deletions
|
@ -20,6 +20,12 @@ buffer_write32be(uint8_t *buf, uint32_t value) {
|
||||||
buf[3] = value;
|
buf[3] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
buffer_write64be(uint8_t *buf, uint64_t value) {
|
||||||
|
buffer_write32be(buf, value >> 32);
|
||||||
|
buffer_write32be(&buf[4], (uint32_t) value);
|
||||||
|
}
|
||||||
|
|
||||||
static inline uint16_t
|
static inline uint16_t
|
||||||
buffer_read16be(const uint8_t *buf) {
|
buffer_read16be(const uint8_t *buf) {
|
||||||
return (buf[0] << 8) | buf[1];
|
return (buf[0] << 8) | buf[1];
|
||||||
|
|
Loading…
Reference in a new issue