Mozzi  version v1.1.0
sound synthesis library for Arduino
IntegerType.h
1 
2 template<uint8_t BYTES> struct IntegerType {
3  // at an odd value, such as 3 bytes? Add one more byte (up to at most 8 bytes)..
4  typedef typename IntegerType<(BYTES < 8) ? (BYTES+1) : 8>::unsigned_type unsigned_type;
5  typedef typename IntegerType<(BYTES < 8) ? (BYTES+1) : 8>::signed_type signed_type;
6 };
7 
8 // These are the specializations for the types that we actually assume to exist:
9 template<> struct IntegerType<1> {
10  typedef uint8_t unsigned_type;
11  typedef int8_t signed_type;
12 };
13 
14 template<> struct IntegerType<2> {
15  typedef uint16_t unsigned_type;
16  typedef int16_t signed_type;
17 };
18 
19 template<> struct IntegerType<4> {
20  typedef uint32_t unsigned_type;
21  typedef int32_t signed_type;
22 };
23 
24 template<> struct IntegerType<8> {
25  typedef uint64_t unsigned_type;
26  typedef int64_t signed_type;
27 };