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

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

style: remove trailing spaces, fix copyright statements.

File size: 1.3 KB
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
[494]4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
[56]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
[2]11#ifndef __SYS__
12#define __SYS__
13
[97]14#include <SDL.h>
[2]15
[90]16#include <unistd.h>
17#include <stdint.h>
[2]18
[17]19#define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
20#define uint32_swap(x) \
[7]21   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
22   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
[2]23
[494]24#if SDL_BYTEORDER == SDL_BIG_ENDIAN
[7]25#define LONG int32_t
[17]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)
[2]32#else
[7]33#define LONG int32_t
[17]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)
[2]40#endif
41
[17]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)
[2]46
47#endif
48
49
50
51
Note: See TracBrowser for help on using the repository browser.