00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _INTEGER_T_HPP
00021 #define _INTEGER_T_HPP
00022
00023
00024 #include <stdlib.h>
00025
00026
00027 #include <sys/param.h>
00028
00029
00030 #if defined (__hpux)
00031 #if defined (__hppa)
00032 #ifndef BYTE_ORDER
00033 #define BYTE_ORDER BIG_ENDIAN
00034 #endif
00035 #elif defined(__ia64)
00036 #ifndef BYTE_ORDER
00037 #define BYTE_ORDER LITTLE_ENDIAN
00038 #endif
00039 #endif
00040 #endif
00041
00042
00043
00044 #include <limits.h>
00045
00046
00047 #if defined(__hpux)
00048 #include <arpa/inet.h>
00049 #else
00050 #include <netinet/in.h>
00051 #endif
00052
00053
00054
00055 #if LONG_LONG_MAX<9223372036854775807LL
00056 #error "long long type definition is not 64 bits"
00057 #else
00058
00059
00060 typedef unsigned long long T_UnsignedInteger64, *T_pUnsignedInteger64;
00061 typedef long long T_Integer64, *T_pInteger64;
00062
00063 #define strtoull_f strtoull
00064 #define strtoll_f strtoll
00065
00066 #define ntohll_f ntohll
00067 #define htonll_f htonll
00068
00069 #endif // LONG_LONG_MAX
00070
00071
00072 typedef unsigned long T_UnsignedInteger32, *T_pUnsignedInteger32;
00073 typedef long T_Integer32, *T_pInteger32;
00074
00075
00076 #if LONG_MAX==9223372036854775807L
00077
00078 #define strtoul_f strtoull
00079 #define strtol_f strtoll
00080
00081 #define ntohl_f ntohll
00082 #define htonl_f htonll
00083
00084 #else
00085
00086 #define strtoul_f strtoul
00087 #define strtol_f strtol
00088
00089 #define ntohl_f ntohl
00090 #define htonl_f htonl
00091
00092 #endif // LONG_MAX
00093
00094
00095 T_UnsignedInteger64 ntohll(T_UnsignedInteger64 P_val);
00096 T_UnsignedInteger64 htonll(T_UnsignedInteger64 P_val);
00097
00098 #if defined(__hpux)
00099 #include "iostream_t.hpp"
00100
00101
00102 #ifndef strtoull
00103 unsigned long long int strtoull(const char *P_nPtr, char **P_endPtr, int P_base);
00104
00105 iostream_output& operator<<(iostream_output& P_ostream,
00106 unsigned long long& P_value);
00107 #endif
00108
00109 #ifndef strtoll
00110 long long int strtoll(const char *P_nPtr, char **P_endPtr, int P_base);
00111
00112 iostream_output& operator<<(iostream_output& P_ostream,
00113 long long& P_value);
00114 #endif
00115
00116 #endif // defined(__hpux)
00117
00118
00119 #endif // _INTEGER_T_HPP