From: Andrey Hristov Date: Mon, 3 Nov 2008 18:07:40 +0000 (+0000) Subject: Fix the windows build X-Git-Tag: BEFORE_HEAD_NS_CHANGE~105 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6fd6b92ffcabd3521f0d4c847e77830db26378a8;p=php Fix the windows build --- diff --git a/ext/mysqlnd/config-win.h b/ext/mysqlnd/config-win.h index 86018221a6..104df4fc4c 100644 --- a/ext/mysqlnd/config-win.h +++ b/ext/mysqlnd/config-win.h @@ -39,10 +39,12 @@ This file is public domain and comes with NO WARRANTY of any kind */ /* Type information */ +/* typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */ +typedef unsigned __int64 ulonglong; typedef __int64 longlong; +*/ typedef int sigset_t; #define longlong_defined @@ -54,45 +56,45 @@ typedef int sigset_t; #ifndef _WIN64 /* Optimized store functions for Intel x86 */ -#define sint2korr(A) (*((int16 *) (A))) -#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ - (((uint32) 255L << 24) | \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0])) : \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0]))) -#define sint4korr(A) (*((long *) (A))) -#define uint2korr(A) (*((uint16 *) (A))) -#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF) -#define uint4korr(A) (*((unsigned long *) (A))) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint8korr(A) (*((ulonglong *) (A))) -#define sint8korr(A) (*((longlong *) (A))) -#define int2store(T,A) *((uint16*) (T))= (uint16) (A) +#define sint2korr(A) (*((int16_t *) (A))) +#define sint3korr(A) ((int32_t) ((((uchar) (A)[2]) & 128) ? \ + (((uint32_t) 255L << 24) | \ + (((uint32_t) (uchar) (A)[2]) << 16) |\ + (((uint32_t) (uchar) (A)[1]) << 8) | \ + ((uint32_t) (uchar) (A)[0])) : \ + (((uint32_t) (uchar) (A)[2]) << 16) |\ + (((uint32_t) (uchar) (A)[1]) << 8) | \ + ((uint32_t) (uchar) (A)[0]))) +#define sint4korr(A) (*((int32_t *) (A))) +#define uint2korr(A) (*((uint16_t *) (A))) +#define uint3korr(A) (int32_t) (*((uint32_t *) (A)) & 0xFFFFFF) +#define uint4korr(A) (*((uint32_t *) (A))) +#define uint5korr(A) ((uint64_t)(((uint32_t) ((uchar) (A)[0])) +\ + (((uint32_t) ((uchar) (A)[1])) << 8) +\ + (((uint32_t) ((uchar) (A)[2])) << 16) +\ + (((uint32_t) ((uchar) (A)[3])) << 24)) +\ + (((uint64_t) ((uchar) (A)[4])) << 32)) +#define uint8korr(A) (*((uint64_t *) (A))) +#define sint8korr(A) (*((int64_t *) (A))) +#define int2store(T,A) *((uint16_t*) (T))= (uint16_t) (A) #define int3store(T,A) { *(T)= (uchar) ((A));\ - *(T+1)=(uchar) (((uint) (A) >> 8));\ + *(T+1)=(uchar) (((uint32_t) (A) >> 8));\ *(T+2)=(uchar) (((A) >> 16)); } -#define int4store(T,A) *((long *) (T))= (long) (A) +#define int4store(T,A) *((int32_t *) (T))= (int32_t) (A) #define int5store(T,A) { *(T)= (uchar)((A));\ *((T)+1)=(uchar) (((A) >> 8));\ *((T)+2)=(uchar) (((A) >> 16));\ *((T)+3)=(uchar) (((A) >> 24)); \ *((T)+4)=(uchar) (((A) >> 32)); } -#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) +#define int8store(T,A) *((uint64_t *) (T))= (uint64_t) (A) -#define doubleget(V,M) { *((long *) &V) = *((long*) M); \ - *(((long *) &V)+1) = *(((long*) M)+1); } -#define doublestore(T,V) { *((long *) T) = *((long*) &V); \ - *(((long *) T)+1) = *(((long*) &V)+1); } -#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); } +#define doubleget(V,M) { *((int32_t *) &V) = *((int32_t*) M); \ + *(((int32_t *) &V)+1) = *(((int32_t*) M)+1); } +#define doublestore(T,V) { *((int32_t *) T) = *((int32_t*) &V); \ + *(((int32_t *) T)+1) = *(((int32_t*) &V)+1); } +#define float4get(V,M) { *((int32_t *) &(V)) = *((int32_t*) (M)); } #define float8get(V,M) doubleget((V),(M)) -#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float)) +#define float4store(V,M) memcpy((char*) V,(char*) (&M),sizeof(float)) #define float8store(V,M) doublestore((V),(M)) #endif /* _WIN64 */