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

Last change on this file since 481 was 97, checked in by Sam Hocevar, 15 years ago
  • Updated the Mac OS X port, thanks to Julian Mayer.
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#include <SDL.h>
14
15#include <unistd.h>
16#include <stdint.h>
17
18#define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
19#define uint32_swap(x) \
20   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
21   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
22
23#if SDL_BYTEORDER == SDL_BIG_ENDIAN
24#define LONG int32_t
25#define uint16_to_intel(x) uint16_swap(x)
26#define uint16_to_local(x) uint16_to_intel(x)
27#define big_uint32_to_local(x) (x)
28#define big_uint16_to_local(x) (x)
29#define uint32_to_intel(x) uint32_swap(x)
30#define uint32_to_local(x) uint32_to_intel(x)
31#else
32#define LONG int32_t
33#define uint16_to_intel(x) (x)
34#define uint16_to_local(x) (x)
35#define uint32_to_local(x) (x)
36#define uint32_to_intel(x) (x)
37#define big_uint32_to_local(x) uint32_swap(x)
38#define big_uint16_to_local(x) uint16_swap(x)
39#endif
40
41#define bltl(x) big_uint32_to_local(x)
42#define bstl(x) big_uint16_to_local(x)
43#define lltl(x) uint32_to_intel(x)
44#define lstl(x) uint16_to_intel(x)
45
46#endif
47
48
49
50
Note: See TracBrowser for help on using the repository browser.