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

Last change on this file since 494 was 494, checked in by Sam Hocevar, 11 years ago

style: remove trailing spaces, fix copyright statements.

File size: 1.3 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com or
8 *  Jonathan Clark.
9 */
10
11#ifndef __SYS__
12#define __SYS__
13
14#include <SDL.h>
15
16#include <unistd.h>
17#include <stdint.h>
18
19#define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
20#define uint32_swap(x) \
21   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
22   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
23
24#if SDL_BYTEORDER == SDL_BIG_ENDIAN
25#define LONG int32_t
26#define uint16_to_intel(x) uint16_swap(x)
27#define uint16_to_local(x) uint16_to_intel(x)
28#define big_uint32_to_local(x) (x)
29#define big_uint16_to_local(x) (x)
30#define uint32_to_intel(x) uint32_swap(x)
31#define uint32_to_local(x) uint32_to_intel(x)
32#else
33#define LONG int32_t
34#define uint16_to_intel(x) (x)
35#define uint16_to_local(x) (x)
36#define uint32_to_local(x) (x)
37#define uint32_to_intel(x) (x)
38#define big_uint32_to_local(x) uint32_swap(x)
39#define big_uint16_to_local(x) uint16_swap(x)
40#endif
41
42#define bltl(x) big_uint32_to_local(x)
43#define bstl(x) big_uint16_to_local(x)
44#define lltl(x) uint32_to_intel(x)
45#define lstl(x) uint16_to_intel(x)
46
47#endif
48
49
50
51
Note: See TracBrowser for help on using the repository browser.