Last change
on this file since 608 was
49,
checked in by Sam Hocevar, 15 years ago
|
- Imported original public domain release, for future reference.
|
-
Property svn:keywords set to
Id
|
File size:
1.4 KB
|
Rev | Line | |
---|
[49] | 1 | #ifndef __SYS__ |
---|
| 2 | #define __SYS__ |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | #ifdef WORDS_BIGENDIAN |
---|
| 6 | #define BIG_ENDIANS |
---|
| 7 | #else |
---|
| 8 | #define LITTLE_ENDIANS |
---|
| 9 | #endif |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | #if defined( __WATCOMC__ ) |
---|
| 13 | // they didn't include this def in their math include |
---|
| 14 | #ifndef M_PI |
---|
| 15 | #define M_PI 3.141592654 |
---|
| 16 | #endif |
---|
| 17 | // so stuff can find proper file ops |
---|
| 18 | #include <io.h> |
---|
| 19 | #elif defined( __POWERPC__ ) |
---|
| 20 | // they didn't include this def in their math include |
---|
| 21 | #ifndef M_PI |
---|
| 22 | #define M_PI 3.141592654 |
---|
| 23 | #endif |
---|
| 24 | #include <unistd.h> |
---|
| 25 | #else |
---|
| 26 | // so apps can find unlink |
---|
| 27 | #include <unistd.h> |
---|
| 28 | #endif |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | #define short_swap(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8)) |
---|
| 32 | #define long_swap(x) \ |
---|
| 33 | ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \ |
---|
| 34 | ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24)) |
---|
| 35 | |
---|
| 36 | #if defined BIG_ENDIANS |
---|
| 37 | #define LONG int |
---|
| 38 | #define int_to_intel(x) short_swap(x) |
---|
| 39 | #define int_to_local(x) int_to_intel(x) |
---|
| 40 | #define big_long_to_local(x) (x) |
---|
| 41 | #define big_short_to_local(x) (x) |
---|
| 42 | #define long_to_intel(x) long_swap(x) |
---|
| 43 | #define long_to_local(x) long_to_intel(x) |
---|
| 44 | #else |
---|
| 45 | #define LONG long |
---|
| 46 | #define int_to_intel(x) (x) |
---|
| 47 | #define int_to_local(x) (x) |
---|
| 48 | #define long_to_local(x) (x) |
---|
| 49 | #define long_to_intel(x) (x) |
---|
| 50 | #define big_long_to_local(x) long_swap(x) |
---|
| 51 | #define big_short_to_local(x) short_swap(x) |
---|
| 52 | #endif |
---|
| 53 | |
---|
| 54 | #define bltl(x) big_long_to_local(x) |
---|
| 55 | #define bstl(x) big_short_to_local(x) |
---|
| 56 | #define lltl(x) long_to_intel(x) |
---|
| 57 | #define lstl(x) int_to_intel(x) |
---|
| 58 | |
---|
| 59 | #endif |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | |
---|
Note: See
TracBrowser
for help on using the repository browser.