Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

swbyteswap.h

00001 /******************************************************************************
00002  *  swkey.h    - macros for byteswapping necessary for big endian cpus (or not)
00003  *
00004  * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
00005  *      CrossWire Bible Society
00006  *      P. O. Box 2528
00007  *      Tempe, AZ  85280-2528
00008  *
00009  * This program is free software; you can redistribute it and/or modify it
00010  * under the terms of the GNU General Public License as published by the
00011  * Free Software Foundation version 2.
00012  *
00013  * This program is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  *
00018  */
00019 
00020 #ifndef SWBYTESWAP_H
00021 #define SWBYTESWAP_H
00022 
00023 #ifdef BIGENDIAN
00024 #ifdef MACOSX
00025 
00026 #include <architecture/byte_order.h>
00027 #define SWAP32(x) NXSwapLittleLongToHost(x)
00028 #define SWAP16(x) NXSwapLittleShortToHost(x)
00029 
00030 #else
00031 #ifdef SPARC_SOLARIS
00032 
00033 #include <sys/pctypes.h>
00034 #define SWAP32(x) lelong(x)
00035 #define SWAP16(x) leshort(x)
00036 
00037 #else // all big endian GNU systems
00038 
00039 #include <byteswap.h>
00040 #define SWAP32(x) bswap_32(x)
00041 #define SWAP16(x) bswap_16(x)
00042 
00043 #endif
00044 #endif
00045 #else //little endian
00046 
00047 #define SWAP32(x) x
00048 #define SWAP16(x) x
00049 
00050 #endif
00051 #endif
00052 

Generated at Tue Jan 22 14:52:48 2002 for The Sword Project by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001