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 /* Defines for Win32 to make it compatible for MySQL */ 5 6 #ifndef _MYSQLND_CONFIG_WIN_H 7 #define _MYSQLND_CONFIG_WIN_H 8 9 #include <sys/locking.h> 10 #include <windows.h> 11 #include <math.h> /* Because of rint() */ 12 #include <fcntl.h> 13 #include <io.h> 14 #include <malloc.h> 15 16 #include <win32/php_stdint.h> 17 18 #ifndef HAVE_INT8_T 19 #define HAVE_INT8_T 20 #endif 21 #ifndef HAVE_UINT8_T 22 #define HAVE_UINT8_T 23 #endif 24 #ifndef HAVE_INT16_T 25 #define HAVE_INT16_T 26 #endif 27 #ifndef HAVE_UINT16_T 28 #define HAVE_UINT16_T 29 #endif 30 #ifndef HAVE_INT32_T 31 #define HAVE_INT32_T 32 #endif 33 #ifndef HAVE_UINT32_T 34 #define HAVE_UINT32_T 35 #endif 36 #ifndef HAVE_INT64_T 37 #define HAVE_INT64_T 38 #endif 39 #ifndef HAVE_UINT64_T 40 #define HAVE_UINT64_T 41 #endif 42 43 44 #ifndef _WIN64 45 #ifndef _WIN32 46 #define _WIN32 /* Compatible with old source */ 47 #endif 48 #ifndef __WIN32__ 49 #define __WIN32__ 50 #endif 51 #endif /* _WIN64 */ 52 #ifndef __WIN__ 53 #define __WIN__ /* To make it easier in VC++ */ 54 #endif 55 56 /* Type information */ 57 58 #define SIZEOF_CHAR 1 59 #define SIZEOF_LONG 4 60 #define SIZEOF_LONG_LONG 8 61 62 63 #ifndef _WIN64 64 /* Optimized store functions for Intel x86 */ 65 66 #define sint2korr(A) (*((int16_t *) (A))) 67 #define sint3korr(A) ((int32_t) ((((zend_uchar) (A)[2]) & 128) ? \ 68 (((uint32_t) 255L << 24) | \ 69 (((uint32_t) (zend_uchar) (A)[2]) << 16) |\ 70 (((uint32_t) (zend_uchar) (A)[1]) << 8) | \ 71 ((uint32_t) (zend_uchar) (A)[0])) : \ 72 (((uint32_t) (zend_uchar) (A)[2]) << 16) |\ 73 (((uint32_t) (zend_uchar) (A)[1]) << 8) | \ 74 ((uint32_t) (zend_uchar) (A)[0]))) 75 #define sint4korr(A) (*((int32_t *) (A))) 76 #define uint2korr(A) (*((uint16_t *) (A))) 77 #define uint3korr(A) (int32_t) (*((uint32_t *) (A)) & 0xFFFFFF) 78 #define uint4korr(A) (*((uint32_t *) (A))) 79 #define uint5korr(A) ((uint64_t)(((uint32_t) ((zend_uchar) (A)[0])) +\ 80 (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\ 81 (((uint32_t) ((zend_uchar) (A)[2])) << 16) +\ 82 (((uint32_t) ((zend_uchar) (A)[3])) << 24)) +\ 83 (((uint64_t) ((zend_uchar) (A)[4])) << 32)) 84 #define uint8korr(A) (*((uint64_t *) (A))) 85 #define sint8korr(A) (*((int64_t *) (A))) 86 #define int2store(T,A) *((uint16_t*) (T))= (uint16_t) (A) 87 #define int3store(T,A) { *(T)= (zend_uchar) ((A));\ 88 *(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\ 89 *(T+2)=(zend_uchar) (((A) >> 16)); } 90 #define int4store(T,A) *((int32_t *) (T))= (int32_t) (A) 91 #define int5store(T,A) { *(T)= (zend_uchar)((A));\ 92 *((T)+1)=(zend_uchar) (((A) >> 8));\ 93 *((T)+2)=(zend_uchar) (((A) >> 16));\ 94 *((T)+3)=(zend_uchar) (((A) >> 24)); \ 95 *((T)+4)=(zend_uchar) (((A) >> 32)); } 96 #define int8store(T,A) *((uint64_t *) (T))= (uint64_t) (A) 97 98 #define float8get(V,M) { *((int32_t *) &V) = *((int32_t*) M); \ 99 *(((int32_t *) &V)+1) = *(((int32_t*) M)+1); } 100 #define float8store(T,V) { *((int32_t *) T) = *((int32_t*) &V); \ 101 *(((int32_t *) T)+1) = *(((int32_t*) &V)+1); } 102 #define float4get(V,M) { *((int32_t *) &(V)) = *((int32_t*) (M)); } 103 104 #endif /* _WIN64 */ 105 106 #endif /* _MYSQLND_CONFIG_WIN_H */ 107 108 /* 109 * Local variables: 110 * tab-width: 4 111 * c-basic-offset: 4 112 * End: 113 * vim600: noet sw=4 ts=4 fdm=marker 114 * vim<600: noet sw=4 ts=4 115 */ 116