source: abuse/trunk/src/imlib/system.h @ 90

Last change on this file since 90 was 90, checked in by Sam Hocevar, 11 years ago
  • Get rid of WATCOMC tests.
File size: 1.3 KB
Line 
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#include <unistd.h>
22#include <stdint.h>
23
24#define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
25#define uint32_swap(x) \
26   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
27   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
28
29#if defined BIG_ENDIANS
30#define LONG int32_t
31#define uint16_to_intel(x) uint16_swap(x)
32#define uint16_to_local(x) uint16_to_intel(x)
33#define big_uint32_to_local(x) (x)
34#define big_uint16_to_local(x) (x)
35#define uint32_to_intel(x) uint32_swap(x)
36#define uint32_to_local(x) uint32_to_intel(x)
37#else
38#define LONG int32_t
39#define uint16_to_intel(x) (x)
40#define uint16_to_local(x) (x)
41#define uint32_to_local(x) (x)
42#define uint32_to_intel(x) (x)
43#define big_uint32_to_local(x) uint32_swap(x)
44#define big_uint16_to_local(x) uint16_swap(x)
45#endif
46
47#define bltl(x) big_uint32_to_local(x)
48#define bstl(x) big_uint16_to_local(x)
49#define lltl(x) uint32_to_intel(x)
50#define lstl(x) uint16_to_intel(x)
51
52#endif
53
54
55
56
Note: See TracBrowser for help on using the repository browser.