19 #include <grass/Vect.h>
58 #define TEST_PATTERN 1.3333
59 #define LONG_TEST 0x01020304
60 #define INT_TEST 0x01020304
61 #define SHORT_TEST 0x0102
70 static const unsigned char dbl_cmpr[] =
71 { 0x3f, 0xf5, 0x55, 0x32, 0x61, 0x7c, 0x1b, 0xda };
73 static const unsigned char flt_cmpr[] = { 0x3f, 0xaa, 0xa9, 0x93 };
74 static const unsigned char lng_cmpr[] = { 0x01, 0x02, 0x03, 0x04 };
75 static const unsigned char int_cmpr[] = { 0x01, 0x02, 0x03, 0x04 };
76 static const unsigned char shrt_cmpr[] = { 0x01, 0x02 };
102 static int find_offset(
const unsigned char *basis,
unsigned char search_value,
107 for (i = 0; i <
size; i++)
108 if (basis[i] == search_value)
114 static int find_offsets(
const void *pattern,
unsigned char *cnvrt,
115 const unsigned char *cmpr,
int port_size,
116 int nat_size,
const char *
typename)
121 for (i = 0; i < port_size; i++) {
122 int off = find_offset(pattern, cmpr[i], nat_size);
125 G_fatal_error(
"could not find '%x' in %s", cmpr[i],
typename);
132 for (i = 0; i < port_size; i++) {
133 if (cnvrt[i] != (nat_size - port_size + i))
135 if (cnvrt[i] != (port_size - 1 - i))
143 return ENDIAN_LITTLE;
unsigned char lng_cnvrt[sizeof(long)]
unsigned char dbl_cnvrt[sizeof(double)]
unsigned char int_cnvrt[sizeof(int)]
unsigned char shrt_cnvrt[sizeof(short)]
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
unsigned char flt_cnvrt[sizeof(float)]