1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * |
---|
5 | * This software was released into the Public Domain. As with most public |
---|
6 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
7 | * Jonathan Clark. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef __SYS__ |
---|
11 | #define __SYS__ |
---|
12 | |
---|
13 | |
---|
14 | #ifdef WORDS_BIGENDIAN |
---|
15 | #define BIG_ENDIANS |
---|
16 | #else |
---|
17 | #define LITTLE_ENDIANS |
---|
18 | #endif |
---|
19 | |
---|
20 | |
---|
21 | #if defined( __WATCOMC__ ) |
---|
22 | // they didn't include this def in their math include |
---|
23 | #ifndef M_PI |
---|
24 | #define M_PI 3.141592654 |
---|
25 | #endif |
---|
26 | // so stuff can find proper file ops |
---|
27 | #include <io.h> |
---|
28 | #elif defined( __POWERPC__ ) |
---|
29 | // they didn't include this def in their math include |
---|
30 | #ifndef M_PI |
---|
31 | #define M_PI 3.141592654 |
---|
32 | #endif |
---|
33 | #include <unistd.h> |
---|
34 | #else |
---|
35 | // so apps can find unlink |
---|
36 | #include <unistd.h> |
---|
37 | #include <stdint.h> |
---|
38 | #endif |
---|
39 | |
---|
40 | |
---|
41 | #define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8)) |
---|
42 | #define uint32_swap(x) \ |
---|
43 | ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \ |
---|
44 | ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24)) |
---|
45 | |
---|
46 | #if defined BIG_ENDIANS |
---|
47 | #define LONG int32_t |
---|
48 | #define uint16_to_intel(x) uint16_swap(x) |
---|
49 | #define uint16_to_local(x) uint16_to_intel(x) |
---|
50 | #define big_uint32_to_local(x) (x) |
---|
51 | #define big_uint16_to_local(x) (x) |
---|
52 | #define uint32_to_intel(x) uint32_swap(x) |
---|
53 | #define uint32_to_local(x) uint32_to_intel(x) |
---|
54 | #else |
---|
55 | #define LONG int32_t |
---|
56 | #define uint16_to_intel(x) (x) |
---|
57 | #define uint16_to_local(x) (x) |
---|
58 | #define uint32_to_local(x) (x) |
---|
59 | #define uint32_to_intel(x) (x) |
---|
60 | #define big_uint32_to_local(x) uint32_swap(x) |
---|
61 | #define big_uint16_to_local(x) uint16_swap(x) |
---|
62 | #endif |
---|
63 | |
---|
64 | #define bltl(x) big_uint32_to_local(x) |
---|
65 | #define bstl(x) big_uint16_to_local(x) |
---|
66 | #define lltl(x) uint32_to_intel(x) |
---|
67 | #define lstl(x) uint16_to_intel(x) |
---|
68 | |
---|
69 | #endif |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | |
---|