1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef AWS_COMMON_BYTE_ORDER_H
#define AWS_COMMON_BYTE_ORDER_H
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/common/common.h>
AWS_EXTERN_C_BEGIN
/**
* Returns 1 if machine is big endian, 0 if little endian.
* If you compile with even -O1 optimization, this check is completely optimized
* out at compile time and code which calls "if (aws_is_big_endian())" will do
* the right thing without branching.
*/
AWS_STATIC_IMPL int aws_is_big_endian(void);
/**
* Convert 64 bit integer from host to network byte order.
*/
AWS_STATIC_IMPL uint64_t aws_hton64(uint64_t x);
/**
* Convert 64 bit integer from network to host byte order.
*/
AWS_STATIC_IMPL uint64_t aws_ntoh64(uint64_t x);
/**
* Convert 32 bit integer from host to network byte order.
*/
AWS_STATIC_IMPL uint32_t aws_hton32(uint32_t x);
/**
* Convert 32 bit float from host to network byte order.
*/
AWS_STATIC_IMPL float aws_htonf32(float x);
/**
* Convert 64 bit double from host to network byte order.
*/
AWS_STATIC_IMPL double aws_htonf64(double x);
/**
* Convert 32 bit integer from network to host byte order.
*/
AWS_STATIC_IMPL uint32_t aws_ntoh32(uint32_t x);
/**
* Convert 32 bit float from network to host byte order.
*/
AWS_STATIC_IMPL float aws_ntohf32(float x);
/**
* Convert 32 bit float from network to host byte order.
*/
AWS_STATIC_IMPL double aws_ntohf64(double x);
/**
* Convert 16 bit integer from host to network byte order.
*/
AWS_STATIC_IMPL uint16_t aws_hton16(uint16_t x);
/**
* Convert 16 bit integer from network to host byte order.
*/
AWS_STATIC_IMPL uint16_t aws_ntoh16(uint16_t x);
#ifndef AWS_NO_STATIC_IMPL
# include <aws/common/byte_order.inl>
#endif /* AWS_NO_STATIC_IMPL */
AWS_EXTERN_C_END
#endif /* AWS_COMMON_BYTE_ORDER_H */