Skip to content

Instantly share code, notes, and snippets.

@kjdev
Created October 12, 2012 01:23
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 kjdev/3876823 to your computer and use it in GitHub Desktop.
Save kjdev/3876823 to your computer and use it in GitHub Desktop.
--- a/msgpack.h
+++ b/msgpack.h
@@ -9,103 +9,13 @@
#include <stdint.h>
#endif
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-/* Typdefs */
-#ifndef HAVE_INT8_T
-#ifndef HAVE_INT8
-typedef signed char int8_t; /* Signed integer >= 8 bits */
-#else
-typedef int8 int8_t; /* Signed integer >= 8 bits */
-#endif
-#endif
-
-#ifndef HAVE_UINT8_T
-#ifndef HAVE_UINT8
-typedef unsigned char uint8_t; /* Unsigned integer >= 8 bits */
-#else
-typedef uint8 uint8_t; /* Signed integer >= 8 bits */
-#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
#endif
-#ifndef HAVE_INT16_T
-#ifndef HAVE_INT16
-typedef signed short int16_t; /* Signed integer >= 16 bits */
-#else
-typedef int16 int16_t; /* Signed integer >= 16 bits */
-#endif
-#endif
-
-#ifndef HAVE_UINT16_T
-#ifndef HAVE_UINT16
-typedef unsigned short uint16_t; /* Signed integer >= 16 bits */
-#else
-typedef uint16 uint16_t; /* Signed integer >= 16 bits */
-#endif
-#endif
-
-#ifndef HAVE_INT32_T
-#ifdef HAVE_INT32
-typedef int32 int32_t;
-#elif SIZEOF_INT == 4
-typedef signed int int32_t;
-#elif SIZEOF_LONG == 4
-typedef signed long int32_t;
-#else
-error "Neither int nor long is of 4 bytes width"
-#endif
-#endif /* HAVE_INT32_T */
-
-#ifndef HAVE_UINT32_T
-#ifdef HAVE_UINT32
-typedef uint32 uint32_t;
-#elif SIZEOF_INT == 4
-typedef unsigned int uint32_t;
-#elif SIZEOF_LONG == 4
-typedef unsigned long uint32_t;
-#else
-#error "Neither int nor long is of 4 bytes width"
-#endif
-#endif /* HAVE_UINT32_T */
-
-#ifndef HAVE_INT64_T
-#ifdef HAVE_INT64
-typedef int64 int64_t;
-#elif SIZEOF_INT == 8
-typedef signed int int64_t;
-#elif SIZEOF_LONG == 8
-typedef signed long int64_t;
-#elif SIZEOF_LONG_LONG == 8
-#ifdef PHP_WIN32
-typedef __int64 int64_t;
-#else
-typedef signed long long int64_t;
-#endif
-#else
-#error "Neither int nor long nor long long is of 8 bytes width"
-#endif
-#endif /* HAVE_INT64_T */
-
-#ifndef HAVE_UINT64_T
-#ifdef HAVE_UINT64
-typedef uint64 uint64_t;
-#elif SIZEOF_INT == 8
-typedef unsigned int uint64_t;
-#elif SIZEOF_LONG == 8
-typedef unsigned long uint64_t;
-#elif SIZEOF_LONG_LONG == 8
-#ifdef PHP_WIN32
-typedef unsigned __int64 uint64_t;
-#else
-typedef unsigned long long uint64_t;
-#endif
-#else
-#error "Neither int nor long nor long long is of 8 bytes width"
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
#endif
-#endif /* HAVE_INT64_T */
-
#ifndef WORDS_BIGENDIAN
/* LETTLEENDIAN */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment