Skip to content

Instantly share code, notes, and snippets.

@dstogov
Created May 19, 2014 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstogov/07fcbb60b1b585bcd290 to your computer and use it in GitHub Desktop.
Save dstogov/07fcbb60b1b585bcd290 to your computer and use it in GitHub Desktop.
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index 82a168f..74024c7 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -22,6 +22,10 @@
#ifndef ZEND_TYPES_H
#define ZEND_TYPES_H
+#ifndef ZEND_WIN32
+# include <inttypes.h>
+#endif
+
#ifdef WORDS_BIGENDIAN
# define ZEND_ENDIAN_LOHI(lo, hi) hi; lo;
# define ZEND_ENDIAN_LOHI_3(lo, mi, hi) hi; mi; lo;
@@ -41,9 +45,35 @@
typedef unsigned char zend_bool;
typedef unsigned char zend_uchar;
typedef unsigned int zend_uint;
-typedef unsigned long zend_ulong;
typedef unsigned short zend_ushort;
+#ifdef _WIN64
+typedef __int64 zend_long;
+typedef unsigned __int64 zend_ulong;
+# define ZEND_INT_MAX _I64_MAX
+# define ZEND_INT_MIN _I64_MIN
+# define ZEND_UINT_MAX _UI64_MAX
+# define Z_I(i) i##i64
+# define Z_UI(i) i##Ui64
+#elif defined(__X86_64__) || defined(__LP64__) || defined(_LP64)
+typedef int64_t zend_long;
+typedef uint64_t zend_ulong;
+# define ZEND_INT_MAX INT64_MAX
+# define ZEND_INT_MIN INT64_MIN
+# define ZEND_UINT_MAX UINT64_MAX
+# define Z_I(i) i##LL
+# define Z_UI(i) i##ULL
+#else
+typedef long zend_long;
+typedef unsigned long zend_ulong;
+# define ZEND_INT_MAX LONG_MAX
+# define ZEND_INT_MIN LONG_MIN
+# define ZEND_UINT_MAX ULONG_MAX
+# define Z_I(i) i##L
+# define Z_UI(i) i##UL
+# define SIZEOF_ZEND_LONG SIZEOF_LONG
+#endif
+
#define HAVE_ZEND_LONG64
#ifdef ZEND_WIN32
typedef __int64 zend_long64;
@@ -87,7 +117,7 @@ typedef void (*dtor_func_t)(zval *pDest);
typedef void (*copy_ctor_func_t)(zval *pElement);
typedef union _zend_value {
- long lval; /* long value */
+ zend_long lval; /* long value */
double dval; /* double value */
zend_refcounted *counted;
zend_string *str;
@@ -138,7 +168,7 @@ struct _zend_refcounted {
struct _zend_string {
zend_refcounted gc;
zend_ulong h; /* hash value */
- int len;
+ size_t len;
char val[1];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment