| 1 |
/* standard.h: standard definitions and types |
| 2 |
* |
| 3 |
* These are some standard definitions and types for ISAAC. |
| 4 |
* |
| 5 |
* This package and its contents are released by the author into the |
| 6 |
* Public Domain, to the full extent permissible by law. For additional |
| 7 |
* information, please see the included `LICENSE' file. |
| 8 |
*/ |
| 9 |
|
| 10 |
#ifndef STANDARD_H |
| 11 |
#define STANDARD_H 1 |
| 12 |
|
| 13 |
/* Determine what type to use based on Perl's detection */ |
| 14 |
#ifdef USE_INT |
| 15 |
typedef unsigned int ub4; |
| 16 |
#else |
| 17 |
typedef unsigned long ub4; |
| 18 |
#endif |
| 19 |
|
| 20 |
#ifndef UINT32_MAX |
| 21 |
#define UINT32_MAX (4294967295U) |
| 22 |
#endif |
| 23 |
|
| 24 |
/* Some miscellaneous bit operation macros */ |
| 25 |
#define bis(target,mask) ((target) |= (mask)) |
| 26 |
#define bic(target,mask) ((target) &= ~(mask)) |
| 27 |
#define bit(target,mask) ((target) & (mask)) |
| 28 |
|
| 29 |
/* Find the minimum of two values */ |
| 30 |
#ifndef min |
| 31 |
#define min(a,b) (((a)<(b)) ? (a) : (b)) |
| 32 |
#endif /* min */ |
| 33 |
|
| 34 |
/* Find the maximum of two values */ |
| 35 |
#ifndef max |
| 36 |
#define max(a,b) (((a)<(b)) ? (b) : (a)) |
| 37 |
#endif /* max */ |
| 38 |
|
| 39 |
#ifndef align |
| 40 |
#define align(a) (((ub4)a+(sizeof(void *)-1))&(~(sizeof(void *)-1))) |
| 41 |
#endif /* align */ |
| 42 |
|
| 43 |
/* Some boolean truth value constants */ |
| 44 |
#ifndef TRUE |
| 45 |
#define TRUE 1 |
| 46 |
#endif /* TRUE */ |
| 47 |
#ifndef FALSE |
| 48 |
#define FALSE 0 |
| 49 |
#endif /* FALSE */ |
| 50 |
|
| 51 |
#endif /* STANDARD_H */ |