Browse CVS Repository
Contents of /autocoast/src/lib/common.hpp
Parent Directory
| Revision Log
| Revision Graph
Revision 1.3 -
( show annotations)
( download)
( as text)
Fri Dec 3 15:08:26 2004 UTC
(19 years, 4 months ago)
by tmurakam
Branch: MAIN
CVS Tags: v0_3, HEAD
Changes since 1.2: +2 -2 lines
File MIME type: text/x-c++hdr
updated
| 1 |
#ifndef _COMMON_H |
| 2 |
#define _COMMON_H |
| 3 |
|
| 4 |
#define BANNER \ |
| 5 |
"AutoCoast: Automatic Coastline scenery generator for Flight Simulator\n" \ |
| 6 |
" Version 0.3\n" \ |
| 7 |
" Copyright (C) 2004, Takuya Murakami. All rights reserved.\n\n" |
| 8 |
|
| 9 |
inline unsigned long htonl(unsigned long x) |
| 10 |
{ |
| 11 |
unsigned long y; |
| 12 |
|
| 13 |
y = (x >> 24) & 0x000000ff | |
| 14 |
(x >> 8) & 0x0000ff00 | |
| 15 |
(x << 8) & 0x00ff0000 | |
| 16 |
(x << 24) & 0xff000000; |
| 17 |
return y; |
| 18 |
} |
| 19 |
|
| 20 |
inline unsigned short htons(unsigned short x) |
| 21 |
{ |
| 22 |
unsigned short y; |
| 23 |
|
| 24 |
y = (x >> 8) & 0x00ff | |
| 25 |
(x << 8) & 0xff00; |
| 26 |
return y; |
| 27 |
} |
| 28 |
|
| 29 |
inline unsigned long ntohl(unsigned long x) { return htonl(x); } |
| 30 |
inline unsigned short ntohs(unsigned short x) { return ntohs(x); } |
| 31 |
|
| 32 |
#define ABS(x) (((x) < 0) ? -(x) : (x)) |
| 33 |
|
| 34 |
#ifdef DEBUG |
| 35 |
inline void AssertFail(const char *fname, int line) |
| 36 |
{ |
| 37 |
fprintf(stderr, "Assertion Failed: %s line %d\n", fname, line); |
| 38 |
exit(1); |
| 39 |
} |
| 40 |
#define ASSERT(x) if ((x)) ; else AssertFail(__FILE__, __LINE__) |
| 41 |
|
| 42 |
#else |
| 43 |
#define ASSERT(x) // |
| 44 |
#endif |
| 45 |
|
| 46 |
#endif |
|