Sha256: 825d8069184d00edd4737d3892cf4a6db835d62544d3d4f26f1a0b543593a710

Contents?: true

Size: 1.8 KB

Versions: 8

Compression:

Stored size: 1.8 KB

Contents

#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 */

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
aws-crt-0.1.8 aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_order.h
aws-crt-0.1.7 aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_order.h
aws-crt-0.1.6 aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_order.h
aws-crt-0.1.5 aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_order.h
aws-crt-0.1.4 aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_order.h
aws-crt-0.1.2 aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_order.h
aws-crt-0.1.1.pre native/crt/aws-c-common/include/aws/common/byte_order.h
aws-crt-0.1.0.pre native/crt/aws-c-common/include/aws/common/byte_order.h