2 * Portable binary serialisation of integral types.
3 * Copyright (C) 2009 Nick Bowler
5 * Copying and distribution of this file, with or without modification,
6 * are permitted in any medium without royalty provided the copyright
7 * notice and this notice are preserved. This file is offered as-is,
8 * without any warranty.
15 #if !defined(PACK_HAVE_64BIT) && defined(ULLONG_MAX) && defined(LLONG_MAX)
16 # define PACK_HAVE_64BIT 1
19 void pack_16_be(unsigned char *, unsigned short);
20 void pack_32_be(unsigned char *, unsigned long);
22 void pack_64_be(unsigned char *, unsigned long long);
25 void pack_16_le(unsigned char *, unsigned short);
26 void pack_32_le(unsigned char *, unsigned long);
28 void pack_64_le(unsigned char *, unsigned long long);
31 unsigned short unpack_16_be(const unsigned char *);
32 unsigned long unpack_32_be(const unsigned char *);
34 unsigned long long unpack_64_be(const unsigned char *);
37 unsigned short unpack_16_le(const unsigned char *);
38 unsigned long unpack_32_le(const unsigned char *);
40 unsigned long long unpack_64_le(const unsigned char *);
43 short unpack_s16_be(const unsigned char *);
44 long unpack_s32_be(const unsigned char *);
46 long long unpack_s64_be(const unsigned char *);
49 short unpack_s16_le(const unsigned char *);
50 long unpack_s32_le(const unsigned char *);
52 long long unpack_s64_le(const unsigned char *);