Eneboo - Documentación para desarrolladores
|
00001 /******************************************************************************** 00002 * endian.h 00003 ******************************************************************************** 00004 * Routines for Little Endian and Big Endian Systems 00005 * Library version 00006 * 00007 * Version 0.4, 2003-09-08 00008 * Author: Björn Berg, clergyman@gmx.de 00009 * 00010 * History: 00011 * 2003-09-08 berg changes in u_int types, adapted to different system 00012 * standards 00013 * 2003-04-18 berg endian.h splitted to endian.h and endian.c 00014 * 00015 * 2003-02-16 jones the #ifndef inclusion guard only protected the #defines 00016 * where it really needs to protect the whole file. Just 00017 * moved the #endif to the end of the file. 00018 * 2003-02-09 jones improved IsBigEndian function 00019 * changes in rotate4b 00020 * 2003-02-01 berg rotate2b / rotate4b added 00021 * 2002-12-12 berg first implementation 00022 *******************************************************************************/ 00023 00024 #ifndef _ANUBISNET_ENDIAN_ 00025 #define _ANUBISNET_ENDIAN_ 00026 00027 /* 00028 * I N C L U D E S 00029 */ 00030 #include <stdio.h> 00031 #include <stdlib.h> 00032 #include <limits.h> 00033 00034 #ifdef __unix__ 00035 #include <sys/types.h> 00036 #ifndef __ANUBISNET_TYPES__ 00037 #define __ANUBISNET_TYPES__ 00038 typedef u_int16_t uint16_t; 00039 typedef u_int32_t uint32_t; 00040 #endif 00041 /* 00042 * Windows does not know UINT16 types, therefore we have to make an improvement 00043 * for 32 Bit systems. unsigned short is only verified to work properly on 32 Bit 00044 * systems. 00045 */ 00046 #elif _WIN32 00047 #include <windows.h> 00048 #ifndef __ANUBISNET_TYPES__ 00049 #define __ANUBISNET_TYPES__ 00050 typedef UINT32 u_int32_t; 00051 typedef unsigned short u_int16_t; 00052 #endif 00053 #else 00054 #include <sys/types.h> 00055 #endif 00056 00057 /* 00058 * D E F I N I T I O N S 00059 */ 00060 typedef int _bool; 00061 #define _true 0x01 00062 #define _false 0x00 00063 00064 /* 00065 * F U N C T I O N S 00066 */ 00067 _bool IsBigEndian (); 00068 short rotate2b ( short var); 00069 unsigned int rotate4b ( unsigned int var ); 00070 00071 #endif