2 * Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 /*----------------------------------------------------------------------------
29 | One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
30 *----------------------------------------------------------------------------*/
33 /*----------------------------------------------------------------------------
34 | The macro `BITS64' can be defined to indicate that 64-bit integer types are
35 | supported by the compiler.
36 *----------------------------------------------------------------------------*/
39 /*----------------------------------------------------------------------------
40 | Each of the following `typedef's defines the most convenient type that holds
41 | integers of at least as many bits as specified. For example, `uint8' should
42 | be the most convenient type that can hold unsigned integers of as many as
43 | 8 bits. The `flag' type must be able to hold either a 0 or 1. For most
44 | implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
45 | to the same as `int'.
46 *----------------------------------------------------------------------------*/
52 typedef unsigned int uint32;
53 typedef signed int int32;
55 typedef unsigned long int uint64;
56 typedef signed long int int64;
59 /*----------------------------------------------------------------------------
60 | Each of the following `typedef's defines a type that holds integers
61 | of _exactly_ the number of bits specified. For instance, for most
62 | implementation of C, `bits16' and `sbits16' should be `typedef'ed to
63 | `unsigned short int' and `signed short int' (or `short int'), respectively.
64 *----------------------------------------------------------------------------*/
65 typedef unsigned char bits8;
66 typedef signed char sbits8;
67 typedef unsigned short int bits16;
68 typedef signed short int sbits16;
69 typedef unsigned int bits32;
70 typedef signed int sbits32;
72 typedef unsigned long int bits64;
73 typedef signed long int sbits64;
77 /*----------------------------------------------------------------------------
78 | The `LIT64' macro takes as its argument a textual integer literal and
79 | if necessary ``marks'' the literal as having a 64-bit integer type.
80 | For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
81 | appended with the letters `LL' standing for `long long', which is `gcc's
82 | name for the 64-bit integer type. Some compilers may allow `LIT64' to be
83 | defined as the identity macro: `#define LIT64( a ) a'.
84 *----------------------------------------------------------------------------*/
85 #define LIT64( a ) a##L
88 /*----------------------------------------------------------------------------
89 | The macro `INLINE' can be used before functions that should be inlined. If
90 | a compiler does not support explicit inlining, this macro should be defined
92 *----------------------------------------------------------------------------*/
93 #define INLINE extern inline