Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 767 Bytes

README.md

File metadata and controls

50 lines (39 loc) · 767 Bytes

libcborg-endianness

Build and Install

$ git clone https://github.com/abenhlal/endianness.git
$ cd endianness
$ mkdir build
$ cd build
$ cmake ..
$ make
$ make test
$ sudo make install

Uninstall

$ sudo make uninstall

Usage and build

$ gcc example.c -o example.bin -L/usr/local/lib/cborg -lcborg-endianness
$ ./example.bin
is_little_endian = 1
8961
1732584193
17279655951921914625
#include <stdio.h>
#include <inttypes.h>
#include <cborg/endianness.h>

int main() {
  printf("cb_is_little_endian = %d\n", cb_is_little_endian());
  printf("%u\n", cb_bswap16(0x0123));
  printf("%u\n", cb_bswap32(0x01234567u));
  printf("%"PRIu64"\n", cb_bswap64(0x0123456789ABCDEFllu));
  return 0;
}

License

MIT