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

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 typedef signed char __s8;
00012 typedef unsigned char __u8;
00013 
00014 typedef signed short __s16;
00015 typedef unsigned short __u16;
00016 
00017 typedef signed int __s32;
00018 typedef unsigned int __u32;
00019 
00020 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
00021 //typedef __signed__ long long __s64;
00022 //typedef unsigned long long __u64;
00023 #endif
00024 
00025 
00026 #define __swap16(x) \
00027         ((__u16)( \
00028                 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
00029                 (((__u16)(x) & (__u16)0xff00U) >> 8) ))
00030 
00031                 
00032 #define __swap32(x) \
00033         ((__u32)( \
00034                 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
00035                 (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) | \
00036                 (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) | \
00037                 (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
00038 
00039                 
00040 #define __swap64(x) \
00041         ((__u64)( \
00042                 (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
00043                 (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
00044                 (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
00045                 (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) <<  8) | \
00046                    (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >>  8) | \
00047                 (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
00048                 (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
00049                 (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
00050                 
00051 
00052 
00053 
00054 #ifndef WORDS_BIGENDIAN
00055 
00056 #define swordtoarch16(x) (x)
00057 #define swordtoarch32(x) (x)
00058 #define swordtoarch64(x) (x)
00059 #define archtosword16(x) (x)
00060 #define archtosword32(x) (x)
00061 #define archtosword64(x) (x)
00062 
00063 #else 
00064 
00065 #define swordtoarch16(x) __swap16(x)
00066 #define swordtoarch32(x) __swap32(x)
00067 #define swordtoarch64(x) __swap64(x)
00068 #define archtosword16(x) __swap16(x)
00069 #define archtosword32(x) __swap32(x)
00070 #define archtosword64(x) __swap64(x)
00071 
00072 
00073 #endif
00074 
00075 
00076 #endif

Generated on Thu Jun 20 22:13:00 2002 for The Sword Project by doxygen1.2.15