Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
UnitGenerator.h
1 /*
2  UnitGenerator.h
3  Pd++
4 
5  Created by Robert Esler on 9/23/14.
6  Copyright (c) 2014 Robert Esler. All rights reserved.
7 
8  Some of the code in Pd++ is Copyright (c) 1997-1999 Miller Puckette.
9  For information on usage and redistribution, and for a DISCLAIMER OF ALL
10  WARRANTIES, see the file, "LICENSE.txt," in this distribution.
11 */
12 
13 /*! \brief This is standard code for all unit generators. */
14 
15 #ifndef Pd___UnitGenerator_h
16 #define Pd___UnitGenerator_h
17 
18 #define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */
19 #define LOGCOSTABSIZE 9
20 #define COSTABSIZE (1<<LOGCOSTABSIZE) // this translates to 512
21 
22 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) \
23 || defined(__OpenBSD__)
24 #include <machine/endian.h>
25 #endif
26 
27 #if defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || \
28 defined(ANDROID)
29 #include <endian.h>
30 #endif
31 
32 #ifdef __MINGW32__
33 #include <sys/param.h>
34 #endif
35 
36 #ifdef _MSC_VER
37 /* _MSVC lacks BYTE_ORDER and LITTLE_ENDIAN */
38 #define LITTLE_ENDIAN 0x0001
39 #define BYTE_ORDER LITTLE_ENDIAN
40 #endif
41 
42 #if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN)
43 #error No byte order defined
44 #endif
45 
46 #if BYTE_ORDER == LITTLE_ENDIAN
47 # define HIOFFSET 1
48 # define LOWOFFSET 0
49 #else
50 # define HIOFFSET 0 /* word offset to find MSB */
51 # define LOWOFFSET 1 /* word offset to find LSB */
52 #endif
53 
54 
55 #endif