aboutsummaryrefslogtreecommitdiff
path: root/lib/endian.h
blob: 70bc5f76bb41928c5d283a1e17127ba948c679ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//=====================================================================
// spdx-license-identifier: ISC
//=====================================================================

#pragma once

#include <stdint.h>

// These functions convert the byte encoding of integer values from host byte order to and from little-endian and
// big-endian byte order
uint16_t htole16(uint16_t host_16b);
uint32_t htole32(uint32_t host_32b);
uint64_t htole64(uint64_t host_64b);

uint16_t htobe16(uint16_t host_16b);
uint32_t htobe32(uint32_t host_32b);
uint64_t htobe64(uint64_t host_64b);