Last change
on this file since 28 was
17,
checked in by Sam Hocevar, 18 years ago
|
- absolute shitloads of 64 bit fixes.
|
File size:
1.5 KB
|
Line | |
---|
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 | #include <stdint.h> |
---|
29 | #endif |
---|
30 | |
---|
31 | |
---|
32 | #define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8)) |
---|
33 | #define uint32_swap(x) \ |
---|
34 | ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \ |
---|
35 | ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24)) |
---|
36 | |
---|
37 | #if defined BIG_ENDIANS |
---|
38 | #define LONG int32_t |
---|
39 | #define uint16_to_intel(x) uint16_swap(x) |
---|
40 | #define uint16_to_local(x) uint16_to_intel(x) |
---|
41 | #define big_uint32_to_local(x) (x) |
---|
42 | #define big_uint16_to_local(x) (x) |
---|
43 | #define uint32_to_intel(x) uint32_swap(x) |
---|
44 | #define uint32_to_local(x) uint32_to_intel(x) |
---|
45 | #else |
---|
46 | #define LONG int32_t |
---|
47 | #define uint16_to_intel(x) (x) |
---|
48 | #define uint16_to_local(x) (x) |
---|
49 | #define uint32_to_local(x) (x) |
---|
50 | #define uint32_to_intel(x) (x) |
---|
51 | #define big_uint32_to_local(x) uint32_swap(x) |
---|
52 | #define big_uint16_to_local(x) uint16_swap(x) |
---|
53 | #endif |
---|
54 | |
---|
55 | #define bltl(x) big_uint32_to_local(x) |
---|
56 | #define bstl(x) big_uint16_to_local(x) |
---|
57 | #define lltl(x) uint32_to_intel(x) |
---|
58 | #define lstl(x) uint16_to_intel(x) |
---|
59 | |
---|
60 | #endif |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | |
---|
Note: See
TracBrowser
for help on using the repository browser.