80 #include <sys/types.h>
84 #define TEST_PATTERN 1.3333
85 #ifdef HAVE_LONG_LONG_INT
86 #define LONG_LONG_TEST 0x0102030405060708LL
88 #define LONG_TEST 0x01020304
89 #define INT_TEST 0x01020304
90 #define SHORT_TEST 0x0102
100 static const unsigned char dbl_cmpr[] = {0x3f, 0xf5, 0x55, 0x32,
101 0x61, 0x7c, 0x1b, 0xda};
103 static const unsigned char flt_cmpr[] = {0x3f, 0xaa, 0xa9, 0x93};
104 static const unsigned char off_t_cmpr[] = {0x01, 0x02, 0x03, 0x04,
105 0x05, 0x06, 0x07, 0x08};
106 static const unsigned char lng_cmpr[] = {0x01, 0x02, 0x03, 0x04};
107 static const unsigned char int_cmpr[] = {0x01, 0x02, 0x03, 0x04};
108 static const unsigned char shrt_cmpr[] = {0x01, 0x02};
136 static int find_offset(
const unsigned char *basis,
unsigned char search_value,
141 for (i = 0; i < size; i++)
142 if (basis[i] == search_value)
148 static int find_offsets(
const void *pattern,
unsigned char *cnvrt,
149 const unsigned char *cmpr,
int port_size,
int nat_size,
150 const char *
typename)
155 for (i = 0; i < port_size; i++) {
156 int off = find_offset(pattern, cmpr[i], nat_size);
166 for (i = 0; i < port_size; i++) {
167 if (cnvrt[i] != (nat_size - port_size + i))
169 if (cnvrt[i] != (port_size - 1 - i))
215 #ifdef HAVE_LONG_LONG_INT
218 G_fatal_error(
"Internal error: can't construct an off_t literal");
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
#define PORT_DOUBLE
Sizes of types used in portable format (different names used in Vlib/ and diglib/ for the same thing)
#define ENDIAN_LITTLE
Endian check.
unsigned char flt_cnvrt[sizeof(float)]
unsigned char dbl_cnvrt[sizeof(double)]
unsigned char lng_cnvrt[sizeof(long)]
unsigned char off_t_cnvrt[sizeof(off_t)]
unsigned char shrt_cnvrt[sizeof(short)]
void port_init(void)
Initialize Port_info structures.
unsigned char int_cnvrt[sizeof(int)]