Intop-Byteorder

TODO: describe module interface

Summary
Intop-ByteorderTODO: describe module interface
CopyrightThis program is free software.
Files
C-kern/api/math/int/byteorder.hHeader file Intop-Byteorder.
C-kern/math/int/byteorder.cImplementation file Intop-Byteorder impl.
Types
struct int_tExport int_t into global namespace.
Functions
test
unittest_math_int_byteorderTest int_t functionality.
int_t
byte-operations
htobe_intConverts host_val from host byte order to big-endian order.
htole_intConverts host_val from host byte order to little-endian order.
betoh_intConverts big_endian_val from big-endian byte order to host byte order.
letoh_intConverts little_endian_val from little-endian byte order to host byte order.
inline implementation
Macros
htobe_intImplements int_t.htobe_int.
htole_intImplements int_t.htole_int.
betoh_intImplements int_t.betoh_int.
letoh_intImplements int_t.letoh_int.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2013 Jörg Seebohn

Files

C-kern/api/math/int/byteorder.h

Header file Intop-Byteorder.

C-kern/math/int/byteorder.c

Implementation file Intop-Byteorder impl.

Types

struct int_t

typedef struct int_t int_t

Export int_t into global namespace.

Functions

Summary

test

unittest_math_int_byteorder

int unittest_math_int_byteorder(void)

Test int_t functionality.

int_t

Summary
byte-operations
htobe_intConverts host_val from host byte order to big-endian order.
htole_intConverts host_val from host byte order to little-endian order.
betoh_intConverts big_endian_val from big-endian byte order to host byte order.
letoh_intConverts little_endian_val from little-endian byte order to host byte order.

byte-operations

htobe_int

unsigned htobe_int(unsigned host_val)

Converts host_val from host byte order to big-endian order.  The returned value is in big-endian order.  This operation is a no-op on big-endian platforms.

htole_int

unsigned htole_int(unsigned host_val)

Converts host_val from host byte order to little-endian order.  The returned value is in little-endian order.  This operation is a no-op on little-endian platforms.

betoh_int

unsigned betoh_int(unsigned big_endian_val)

Converts big_endian_val from big-endian byte order to host byte order.  The returned value is in host byte order.  This operation is a no-op on big-endian platforms.

letoh_int

unsigned letoh_int(unsigned little_endian_val)

Converts little_endian_val from little-endian byte order to host byte order.  The returned value is in host byte order.  This operation is a no-op on little-endian platforms.

inline implementation

Macros

htobe_int

Implements int_t.htobe_int.

htole_int

Implements int_t.htole_int.

betoh_int

Implements int_t.betoh_int.

letoh_int

Implements int_t.letoh_int.

TODO: describe module interface
Implements Intop-Byteorder.
typedef struct int_t int_t
Export int_t into global namespace.
int unittest_math_int_byteorder(void)
Test int_t functionality.
unsigned htobe_int(unsigned host_val)
Converts host_val from host byte order to big-endian order.
unsigned htole_int(unsigned host_val)
Converts host_val from host byte order to little-endian order.
unsigned betoh_int(unsigned big_endian_val)
Converts big_endian_val from big-endian byte order to host byte order.
unsigned letoh_int(unsigned little_endian_val)
Converts little_endian_val from little-endian byte order to host byte order.
Close