xref: /PHP-5.4/ext/mysqlnd/mysqlnd_portability.h (revision 159ed311)
1 /* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
2 This file is public domain and comes with NO WARRANTY of any kind */
3 
4 /*
5   Parts of the original, which are not applicable to mysqlnd have been removed.
6 
7   With small modifications, mostly casting but adding few more macros by
8   Andrey Hristov <andrey@mysql.com> . The additions are in the public domain and
9   were added to improve the header file, to get it more consistent.
10 */
11 
12 #ifndef MYSQLND_PORTABILITY_H
13 #define MYSQLND_PORTABILITY_H
14 
15 
16 
17 /* Comes from global.h as OFFSET, renamed to STRUCT_OFFSET */
18 #define STRUCT_OFFSET(t, f)   ((size_t)(char *)&((t *)0)->f)
19 
20 #ifndef __attribute
21 #if !defined(__GNUC__)
22 #define __attribute(A)
23 #endif
24 #endif
25 
26 #ifdef __CYGWIN__
27 /* We use a Unix API, so pretend it's not Windows */
28 #undef WIN
29 #undef WIN32
30 #undef _WIN
31 #undef _WIN32
32 #undef _WIN64
33 #undef __WIN__
34 #undef __WIN32__
35 #endif /* __CYGWIN__ */
36 
37 #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
38 #  include "ext/mysqlnd/config-win.h"
39 #else
40 #  include <ext/mysqlnd/php_mysqlnd_config.h>
41 #endif /* _WIN32... */
42 
43 #if __STDC_VERSION__ < 199901L && !defined(atoll)
44   /* "inline" is a keyword */
45   #define atoll atol
46 #endif
47 
48 
49 #ifdef HAVE_SYS_TYPES_H
50 #include <sys/types.h>
51 #endif
52 
53 #ifdef HAVE_STDINT_H
54 #include <stdint.h>
55 #endif
56 
57 #if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG)
58 #define _LONG_LONG 1        /* For AIX string library */
59 #endif
60 
61 
62 /* Go around some bugs in different OS and compilers */
63 #if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H)
64 #include <sys/stream.h>        /* HPUX 10.20 defines ulong here. UGLY !!! */
65 #define HAVE_ULONG
66 #endif
67 
68 
69 #if SIZEOF_LONG_LONG > 4
70 #define HAVE_LONG_LONG 1
71 #endif
72 
73 
74 /* Typdefs for easyier portability */
75 #ifndef HAVE_INT8_T
76 #ifndef HAVE_INT8
77 typedef signed char int8_t;			/* Signed integer >= 8    bits */
78 #else
79 typedef int8 int8_t;				/* Signed integer >= 8    bits */
80 #endif
81 #endif
82 
83 #ifndef HAVE_UINT8_T
84 #ifndef HAVE_UINT8
85 typedef unsigned char uint8_t;		/* Unsigned integer >= 8    bits */
86 #else
87 typedef uint8 uint8_t;				/* Signed integer >= 8    bits */
88 #endif
89 #endif
90 
91 #ifndef HAVE_INT16_T
92 #ifndef HAVE_INT16
93 typedef signed short int16_t;		/* Signed integer >= 16 bits */
94 #else
95 typedef int16 int16_t;				/* Signed integer >= 16 bits */
96 #endif
97 #endif
98 
99 #ifndef HAVE_UINT16_T
100 #ifndef HAVE_UINT16
101 typedef unsigned short uint16_t;		/* Signed integer >= 16 bits */
102 #else
103 typedef uint16 uint16_t;			/* Signed integer >= 16 bits */
104 #endif
105 #endif
106 
107 
108 #ifndef HAVE_INT32_T
109 #ifdef HAVE_INT32
110 typedef int32 int32_t;
111 #elif SIZEOF_INT == 4
112 typedef signed int int32_t;
113 #elif SIZEOF_LONG == 4
114 typedef signed long int32_t;
115 #else
116 error "Neither int nor long is of 4 bytes width"
117 #endif
118 #endif /* HAVE_INT32_T */
119 
120 #ifndef HAVE_UINT32_T
121 #ifdef HAVE_UINT32
122 typedef uint32 uint32_t;
123 #elif SIZEOF_INT == 4
124 typedef unsigned int uint32_t;
125 #elif SIZEOF_LONG == 4
126 typedef unsigned long uint32_t;
127 #else
128 #error "Neither int nor long is of 4 bytes width"
129 #endif
130 #endif /* HAVE_UINT32_T */
131 
132 #ifndef HAVE_INT64_T
133 #ifdef HAVE_INT64
134 typedef int64 int64_t;
135 #elif SIZEOF_INT == 8
136 typedef signed int int64_t;
137 #elif SIZEOF_LONG == 8
138 typedef signed long int64_t;
139 #elif SIZEOF_LONG_LONG == 8
140 #ifdef PHP_WIN32
141 typedef __int64 int64_t;
142 #else
143 typedef signed long long int64_t;
144 #endif
145 #else
146 #error "Neither int nor long nor long long is of 8 bytes width"
147 #endif
148 #endif /* HAVE_INT64_T */
149 
150 #ifndef HAVE_UINT64_T
151 #ifdef HAVE_UINT64
152 typedef uint64 uint64_t;
153 #elif SIZEOF_INT == 8
154 typedef unsigned int uint64_t;
155 #elif SIZEOF_LONG == 8
156 typedef unsigned long uint64_t;
157 #elif SIZEOF_LONG_LONG == 8
158 #ifdef PHP_WIN32
159 typedef unsigned __int64 uint64_t;
160 #else
161 typedef unsigned long long uint64_t;
162 #endif
163 #else
164 #error "Neither int nor long nor long long is of 8 bytes width"
165 #endif
166 #endif /* HAVE_INT64_T */
167 
168 
169 #ifdef PHP_WIN32
170 #define MYSQLND_LLU_SPEC "%I64u"
171 #define MYSQLND_LL_SPEC "%I64d"
172 #define MYSQLND_SZ_T_SPEC "%Id"
173 #ifndef L64
174 #define L64(x) x##i64
175 #endif
176 #else
177 
178 #if __i386__
179 #define MYSQLND_LL_SPEC	"%lli"
180 #define MYSQLND_LLU_SPEC "%llu"
181 #endif
182 
183 #if __ia64__
184 #define MYSQLND_LL_SPEC	"%li"
185 #define MYSQLND_LLU_SPEC "%lu"
186 #endif
187 
188 #if __powerpc64__ || __ppc64__
189 #define MYSQLND_LL_SPEC	"%li"
190 #define MYSQLND_LLU_SPEC "%lu"
191 #endif
192 
193 #if (__powerpc__ || __ppc__ ) && !(__powerpc64__ || __ppc64__)
194 #define MYSQLND_LL_SPEC	"%lli"
195 #define MYSQLND_LLU_SPEC "%llu"
196 #endif
197 
198 #if __x86_64__
199 #define MYSQLND_LL_SPEC	"%li"
200 #define MYSQLND_LLU_SPEC "%lu"
201 #endif
202 
203 #if __s390x__
204 #define MYSQLND_LL_SPEC	"%li"
205 #define MYSQLND_LLU_SPEC "%lu"
206 #endif
207 
208 #if __s390__ && !__s390x__
209 #define MYSQLND_LL_SPEC	"%lli"
210 #define MYSQLND_LLU_SPEC "%llu"
211 #endif
212 
213 #ifdef _AIX
214 #define MYSQLND_LL_SPEC "%lli"
215 #define MYSQLND_LLU_SPEC "%llu"
216 #endif
217 
218 #ifndef MYSQLND_LL_SPEC
219   #if SIZEOF_LONG == 8
220     #define MYSQLND_LL_SPEC "%li"
221   #elif SIZEOF_LONG == 4
222     #define MYSQLND_LL_SPEC "%lli"
223   #endif
224 #endif
225 
226 #ifndef MYSQLND_LLU_SPEC
227   #if SIZEOF_LONG == 8
228     #define MYSQLND_LLU_SPEC "%lu"
229   #elif SIZEOF_LONG == 4
230     #define MYSQLND_LLU_SPEC "%llu"
231    #endif
232 #endif /* MYSQLND_LLU_SPEC*/
233 
234 
235 #define MYSQLND_SZ_T_SPEC "%zd"
236 #ifndef L64
237 #define L64(x) x##LL
238 #endif
239 #endif
240 
241 
242 #define int1store(T,A)	do { *((int8_t*) (T)) = (A); } while(0)
243 #define uint1korr(A)	(*(((uint8_t*)(A))))
244 
245 /* Bit values are sent in reverted order of bytes, compared to normal !!! */
246 #define bit_uint2korr(A) ((uint16_t) (((uint16_t) (((unsigned char*) (A))[1])) +\
247                                    ((uint16_t) (((unsigned char*) (A))[0]) << 8)))
248 #define bit_uint3korr(A) ((uint32_t) (((uint32_t) (((unsigned char*) (A))[2])) +\
249                                    (((uint32_t) (((unsigned char*) (A))[1])) << 8) +\
250                                    (((uint32_t) (((unsigned char*) (A))[0])) << 16)))
251 #define bit_uint4korr(A) ((uint32_t) (((uint32_t) (((unsigned char*) (A))[3])) +\
252                                    (((uint32_t) (((unsigned char*) (A))[2])) << 8) +\
253                                    (((uint32_t) (((unsigned char*) (A))[1])) << 16) +\
254                                    (((uint32_t) (((unsigned char*) (A))[0])) << 24)))
255 #define bit_uint5korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[4])) +\
256                                     (((uint32_t) (((unsigned char*) (A))[3])) << 8) +\
257                                     (((uint32_t) (((unsigned char*) (A))[2])) << 16) +\
258                                    (((uint32_t) (((unsigned char*) (A))[1])) << 24)) +\
259                                     (((uint64_t) (((unsigned char*) (A))[0])) << 32))
260 #define bit_uint6korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[5])) +\
261                                     (((uint32_t) (((unsigned char*) (A))[4])) << 8) +\
262                                     (((uint32_t) (((unsigned char*) (A))[3])) << 16) +\
263                                     (((uint32_t) (((unsigned char*) (A))[2])) << 24)) +\
264                         (((uint64_t) (((uint32_t) (((unsigned char*) (A))[1])) +\
265                                     (((uint32_t) (((unsigned char*) (A))[0]) << 8)))) <<\
266                                      32))
267 #define bit_uint7korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[6])) +\
268                                     (((uint32_t) (((unsigned char*) (A))[5])) << 8) +\
269                                     (((uint32_t) (((unsigned char*) (A))[4])) << 16) +\
270                                    (((uint32_t) (((unsigned char*) (A))[3])) << 24)) +\
271                         (((uint64_t) (((uint32_t) (((unsigned char*) (A))[2])) +\
272                                     (((uint32_t) (((unsigned char*) (A))[1])) << 8) +\
273                                     (((uint32_t) (((unsigned char*) (A))[0])) << 16))) <<\
274                                      32))
275 #define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[7])) +\
276                                     (((uint32_t) (((unsigned char*) (A))[6])) << 8) +\
277                                     (((uint32_t) (((unsigned char*) (A))[5])) << 16) +\
278                                     (((uint32_t) (((unsigned char*) (A))[4])) << 24)) +\
279                         (((uint64_t) (((uint32_t) (((unsigned char*) (A))[3])) +\
280                                     (((uint32_t) (((unsigned char*) (A))[2])) << 8) +\
281                                     (((uint32_t) (((unsigned char*) (A))[1])) << 16) +\
282                                     (((uint32_t) (((unsigned char*) (A))[0])) << 24))) <<\
283                                     32))
284 
285 
286 /*
287 ** Define-funktions for reading and storing in machine independent format
288 **  (low byte first)
289 */
290 
291 /* Optimized store functions for Intel x86, non-valid for WIN64. __i386__ is GCC */
292 #if defined(__i386__) && !defined(_WIN64)
293 #define sint2korr(A)    (*((int16_t *) (A)))
294 #define sint3korr(A)    ((int32_t) ((((zend_uchar) (A)[2]) & 128) ? \
295                    (((uint32_t) 255L << 24) | \
296                    (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
297                    (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
298                     ((uint32_t) (zend_uchar) (A)[0])) : \
299                    (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
300                    (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
301                     ((uint32_t) (zend_uchar) (A)[0])))
302 #define sint4korr(A)  (*((long *) (A)))
303 
304 #define uint2korr(A)  (*((uint16_t *) (A)))
305 #define uint3korr(A)  (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\
306                                (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
307                                (((uint32_t) ((zend_uchar) (A)[2])) << 16))
308 #define uint4korr(A)  (*((unsigned long *) (A)))
309 
310 
311 
312 #define uint8korr(A)    (*((uint64_t *) (A)))
313 #define sint8korr(A)    (*((int64_t *) (A)))
314 #define int2store(T,A)    *((uint16_t*) (T))= (uint16_t) (A)
315 #define int3store(T,A)   { \
316                   *(T)=  (zend_uchar) ((A));\
317                   *(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\
318                   *(T+2)=(zend_uchar) (((A) >> 16)); }
319 #define int4store(T,A)    *((long *) (T))= (long) (A)
320 #define int5store(T,A)    { \
321               *((zend_uchar *)(T))= (zend_uchar)((A));\
322               *(((zend_uchar *)(T))+1)=(zend_uchar) (((A) >> 8));\
323               *(((zend_uchar *)(T))+2)=(zend_uchar) (((A) >> 16));\
324               *(((zend_uchar *)(T))+3)=(zend_uchar) (((A) >> 24)); \
325               *(((zend_uchar *)(T))+4)=(zend_uchar) (((A) >> 32)); }
326 
327 /* From Andrey Hristov, based on int5store() */
328 #define int6store(T,A)    { \
329               *(((zend_uchar *)(T)))= (zend_uchar)((A));\
330               *(((zend_uchar *)(T))+1))=(zend_uchar) (((A) >> 8));\
331               *(((zend_uchar *)(T))+2))=(zend_uchar) (((A) >> 16));\
332               *(((zend_uchar *)(T))+3))=(zend_uchar) (((A) >> 24)); \
333               *(((zend_uchar *)(T))+4))=(zend_uchar) (((A) >> 32)); \
334               *(((zend_uchar *)(T))+5))=(zend_uchar) (((A) >> 40)); }
335 
336 #define int8store(T,A)    *((uint64_t *) (T))= (uint64_t) (A)
337 
338 typedef union {
339   double v;
340   long m[2];
341 } float8get_union;
342 #define float8get(V,M)    { ((float8get_union *)&(V))->m[0] = *((long*) (M)); \
343                             ((float8get_union *)&(V))->m[1] = *(((long*) (M))+1); }
344 #define float8store(T,V) { *((long *) (T))     = ((float8get_union *)&(V))->m[0]; \
345                            *(((long *) (T))+1) = ((float8get_union *)&(V))->m[1]; }
346 #define float4get(V,M)	{ *((float *) &(V)) = *((float*) (M)); }
347 /* From Andrey Hristov based on float8get */
348 #define floatget(V,M)    memcpy((char*) &(V),(char*) (M),sizeof(float))
349 #endif /* __i386__ */
350 
351 
352 /* If we haven't defined sint2korr, which is because the platform is not x86 or it's WIN64 */
353 #ifndef sint2korr
354 #define sint2korr(A)    (int16_t) (((int16_t) ((zend_uchar) (A)[0])) +\
355                                  ((int16_t) ((int16_t) (A)[1]) << 8))
356 #define sint3korr(A)    ((int32_t) ((((zend_uchar) (A)[2]) & 128) ? \
357                   (((uint32_t) 255L << 24) | \
358                   (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
359                   (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
360                    ((uint32_t) (zend_uchar) (A)[0])) : \
361                   (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
362                   (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
363                   ((uint32_t) (zend_uchar) (A)[0])))
364 #define sint4korr(A)  (int32_t) (((int32_t) ((zend_uchar) (A)[0])) +\
365                               (((int32_t) ((zend_uchar) (A)[1]) << 8)) +\
366                               (((int32_t) ((zend_uchar) (A)[2]) << 16)) +\
367                               (((int32_t) ((int16_t) (A)[3]) << 24)))
368 
369 #define sint8korr(A)  (int64_t) uint8korr(A)
370 #define uint2korr(A)  (uint16_t) (((uint16_t) ((zend_uchar) (A)[0])) +\
371                                ((uint16_t) ((zend_uchar) (A)[1]) << 8))
372 #define uint3korr(A)  (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\
373                                (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
374                                (((uint32_t) ((zend_uchar) (A)[2])) << 16))
375 #define uint4korr(A)  (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\
376                                (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
377                                (((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
378                                (((uint32_t) ((zend_uchar) (A)[3])) << 24))
379 
380 #define uint8korr(A)	((uint64_t)(((uint32_t) ((zend_uchar) (A)[0])) +\
381 									(((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
382 									(((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
383 									(((uint32_t) ((zend_uchar) (A)[3])) << 24)) +\
384 									(((uint64_t) (((uint32_t) ((zend_uchar) (A)[4])) +\
385 									(((uint32_t) ((zend_uchar) (A)[5])) << 8) +\
386 									(((uint32_t) ((zend_uchar) (A)[6])) << 16) +\
387 									(((uint32_t) ((zend_uchar) (A)[7])) << 24))) << 32))
388 
389 
390 #define int2store(T,A)  do { uint32_t def_temp= (uint32_t) (A) ;\
391                   *((zend_uchar*) (T))  =  (zend_uchar)(def_temp); \
392                   *((zend_uchar*) (T+1)) = (zend_uchar)((def_temp >> 8)); } while (0)
393 #define int3store(T,A)  do { /*lint -save -e734 */\
394                   *(((char *)(T)))   = (char) ((A));\
395                   *(((char *)(T))+1) = (char) (((A) >> 8));\
396                   *(((char *)(T))+2) = (char) (((A) >> 16)); \
397                   /*lint -restore */} while (0)
398 #define int4store(T,A)  do { \
399                   *(((char *)(T)))   = (char) ((A));\
400                   *(((char *)(T))+1) = (char) (((A) >> 8));\
401                   *(((char *)(T))+2) = (char) (((A) >> 16));\
402                   *(((char *)(T))+3) = (char) (((A) >> 24)); } while (0)
403 #define int5store(T,A)  do { \
404                   *(((char *)(T)))   = (char)((A));\
405                   *(((char *)(T))+1) = (char)(((A) >> 8));\
406                   *(((char *)(T))+2) = (char)(((A) >> 16));\
407                   *(((char *)(T))+3) = (char)(((A) >> 24)); \
408                   *(((char *)(T))+4) = (char)(((A) >> 32)); } while (0)
409 /* Based on int5store() from Andrey Hristov */
410 #define int6store(T,A)  do { \
411                   *(((char *)(T)))   = (char)((A));\
412                   *(((char *)(T))+1) = (char)(((A) >> 8));\
413                   *(((char *)(T))+2) = (char)(((A) >> 16));\
414                   *(((char *)(T))+3) = (char)(((A) >> 24)); \
415                   *(((char *)(T))+4) = (char)(((A) >> 32)); \
416                   *(((char *)(T))+5) = (char)(((A) >> 40)); } while (0)
417 #define int8store(T,A)        { uint32_t def_temp= (uint32_t) (A), def_temp2= (uint32_t) ((A) >> 32); \
418                   int4store((T),def_temp); \
419                   int4store((T+4),def_temp2); \
420                 }
421 #ifdef WORDS_BIGENDIAN
422 #define float4get(V,M)   do { float def_temp;\
423                           ((char*) &def_temp)[0] = (M)[3];\
424                           ((char*) &def_temp)[1] = (M)[2];\
425                           ((char*) &def_temp)[2] = (M)[1];\
426                           ((char*) &def_temp)[3] = (M)[0];\
427                           (V)=def_temp; } while (0)
428 #define float8store(T,V)  do { \
429                            *(((char *)(T)))   = (char) ((char *) &(V))[7];\
430                            *(((char *)(T))+1) = (char) ((char *) &(V))[6];\
431                            *(((char *)(T))+2) = (char) ((char *) &(V))[5];\
432                            *(((char *)(T))+3) = (char) ((char *) &(V))[4];\
433                            *(((char *)(T))+4) = (char) ((char *) &(V))[3];\
434                            *(((char *)(T))+5) = (char) ((char *) &(V))[2];\
435                            *(((char *)(T))+6) = (char) ((char *) &(V))[1];\
436                            *(((char *)(T))+7) = (char) ((char *) &(V))[0]; } while (0)
437 
438 #define float8get(V,M)   do { double def_temp;\
439                           ((char*) &def_temp)[0] = (M)[7];\
440                           ((char*) &def_temp)[1] = (M)[6];\
441                           ((char*) &def_temp)[2] = (M)[5];\
442                           ((char*) &def_temp)[3] = (M)[4];\
443                           ((char*) &def_temp)[4] = (M)[3];\
444                           ((char*) &def_temp)[5] = (M)[2];\
445                           ((char*) &def_temp)[6] = (M)[1];\
446                           ((char*) &def_temp)[7] = (M)[0];\
447                           (V) = def_temp; \
448                          } while (0)
449 #else
450 #define float4get(V,M)   memcpy((char*) &(V),(char*) (M),sizeof(float))
451 
452 #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
453 #define float8store(T,V)  do { \
454                          *(((char *)(T)))= ((char *) &(V))[4];\
455                          *(((char *)(T))+1)=(char) ((char *) &(V))[5];\
456                          *(((char *)(T))+2)=(char) ((char *) &(V))[6];\
457                          *(((char *)(T))+3)=(char) ((char *) &(V))[7];\
458                          *(((char *)(T))+4)=(char) ((char *) &(V))[0];\
459                          *(((char *)(T))+5)=(char) ((char *) &(V))[1];\
460                          *(((char *)(T))+6)=(char) ((char *) &(V))[2];\
461                          *(((char *)(T))+7)=(char) ((char *) &(V))[3];} while (0)
462 #define float8get(V,M) do { double def_temp;\
463                          ((char*) &def_temp)[0]=(M)[4];\
464                          ((char*) &def_temp)[1]=(M)[5];\
465                          ((char*) &def_temp)[2]=(M)[6];\
466                          ((char*) &def_temp)[3]=(M)[7];\
467                          ((char*) &def_temp)[4]=(M)[0];\
468                          ((char*) &def_temp)[5]=(M)[1];\
469                          ((char*) &def_temp)[6]=(M)[2];\
470                          ((char*) &def_temp)[7]=(M)[3];\
471                          (V) = def_temp; } while (0)
472 #endif /* __FLOAT_WORD_ORDER */
473 
474 #endif /* WORDS_BIGENDIAN */
475 
476 #endif /* sint2korr */
477 /* To here if the platform is not x86 or it's WIN64 */
478 
479 
480 /* Define-funktions for reading and storing in machine format from/to
481    short/long to/from some place in memory V should be a (not
482    register) variable, M is a pointer to byte */
483 
484 #ifndef float8get
485 
486 #ifdef WORDS_BIGENDIAN
487 #define float8get(V,M)		memcpy((char*) &(V),(char*)  (M), sizeof(double))
488 #define float8store(T,V)	memcpy((char*)  (T),(char*) &(V), sizeof(double))
489 #else
490 #define float8get(V,M)    memcpy((char*) &(V),(char*) (M),sizeof(double))
491 #define float8store(T,V)  memcpy((char*) (T),(char*) &(V),sizeof(double))
492 #endif /* WORDS_BIGENDIAN */
493 
494 #endif /* float8get */
495 
496 #endif /* MYSQLND_PORTABILITY_H */
497 
498 
499 /*
500  * Local variables:
501  * tab-width: 4
502  * c-basic-offset: 4
503  * End:
504  * vim600: noet sw=4 ts=4 fdm=marker
505  * vim<600: noet sw=4 ts=4
506  */
507