summaryrefslogtreecommitdiff
path: root/yajl/yajl_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'yajl/yajl_common.h')
-rw-r--r--yajl/yajl_common.h50
1 files changed, 34 insertions, 16 deletions
diff --git a/yajl/yajl_common.h b/yajl/yajl_common.h
index 95a5ab7..3558c7d 100644
--- a/yajl/yajl_common.h
+++ b/yajl/yajl_common.h
@@ -53,6 +53,7 @@ extern "C" {
#endif
// Create a cross platform 64 bit int type "longlong" - GWG
+#ifndef NUMLIB_H
#if (__STDC_VERSION__ >= 199901L) /* C99 */
@@ -93,27 +94,44 @@ typedef __int64 longlong;
/* LLP64 and LP64 models, but won't work with ILP64 which needs int32 */
#ifdef __GNUC__
-
-typedef long long longlong;
-
-# define PF64PREC "ll" /* printf format precision specifier */
-# define CF64PREC "LL" /* Constant precision specifier */
-
-# ifndef LLONG_MIN
-# define LLONG_MIN (-LLONG_MAX-1)
-# endif
-# ifndef LLONG_MAX
-# define LLONG_MAX __LONG_LONG_MAX__
-# endif
-# ifndef ULLONG_MAX
-# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
-# endif
-
+# ifdef __LP64__ /* long long could be 128 bit ? */
+ typedef long longlong;
+# define PF64PREC "l" /* printf format precision specifier */
+# define CF64PREC "L" /* Constant precision specifier */
+# ifndef LLONG_MAX
+# define LLONG_MAX __LONG_MAX__
+# endif
+# ifndef LLONG_MIN
+# define LLONG_MIN (-LLONG_MAX-1)
+# endif
+# ifndef ULLONG_MAX
+# define ULLONG_MAX (LLONG_MAX * 2UL + 1)
+# endif
+# else /* long could be 32 bits */
+ typedef long long longlong;
+# define PF64PREC "ll" /* printf format precision specifier */
+# define CF64PREC "LL" /* Constant precision specifier */
+# ifndef LLONG_MAX
+# define LLONG_MAX __LONG_LONG_MAX__
+# endif
+# ifndef LLONG_MIN
+# define LLONG_MIN (-LLONG_MAX-1)
+# endif
+# ifndef ULLONG_MAX
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
+# endif
+# endif /* !__LP64__ */
#endif /* __GNUC__ */
#endif /* !_MSC_VER */
#endif /* !__STDC_VERSION__ */
+#else /* !NUMLIB_H */
+
+typedef INR64 longlong ;
+
+#endif /* !NUMLIB_H */
+
/** pointer to a malloc function, supporting client overriding memory
* allocation routines */
typedef void * (*yajl_malloc_func)(void *ctx, size_t sz);