Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

sysdata.h

00001 #ifndef SIZEDTYPES_H
00002 #define SIZEDTYPES_H
00003 /*
00004  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
00005  * header files exported to user space
00006  */
00007 #ifdef USE_AUTOTOOLS
00008 #include "config.h"
00009 #endif
00010 
00011 
00012 typedef signed char __s8;
00013 typedef unsigned char __u8;
00014 
00015 typedef signed short __s16;
00016 typedef unsigned short __u16;
00017 
00018 typedef signed int __s32;
00019 typedef unsigned int __u32;
00020 
00021 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
00022 //typedef __signed__ long long __s64;
00023 //typedef unsigned long long __u64;
00024 #endif
00025 
00026 
00027 #define __swap16(x) \
00028         ((__u16)( \
00029                 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
00030                 (((__u16)(x) & (__u16)0xff00U) >> 8) ))
00031 
00032                 
00033 #define __swap32(x) \
00034         ((__u32)( \
00035                 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
00036                 (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) | \
00037                 (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) | \
00038                 (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
00039 
00040                 
00041 #define __swap64(x) \
00042         ((__u64)( \
00043                 (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
00044                 (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
00045                 (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
00046                 (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) <<  8) | \
00047                    (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >>  8) | \
00048                 (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
00049                 (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
00050                 (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
00051                 
00052 
00053 
00054 
00055 #ifndef WORDS_BIGENDIAN
00056 
00057 #define swordtoarch16(x) (x)
00058 #define swordtoarch32(x) (x)
00059 #define swordtoarch64(x) (x)
00060 #define archtosword16(x) (x)
00061 #define archtosword32(x) (x)
00062 #define archtosword64(x) (x)
00063 
00064 #else 
00065 
00066 #define swordtoarch16(x) __swap16(x)
00067 #define swordtoarch32(x) __swap32(x)
00068 #define swordtoarch64(x) __swap64(x)
00069 #define archtosword16(x) __swap16(x)
00070 #define archtosword32(x) __swap32(x)
00071 #define archtosword64(x) __swap64(x)
00072 
00073 
00074 #endif
00075 
00076 
00077 #endif

Generated on Fri Feb 28 22:01:39 2003 for The Sword Project by doxygen1.3-rc3