+/* Macros with automatic casts */
+#define U64_AT(p) ( ntoh64 ( *( (u64 *)(p) ) ) )
+#define U32_AT(p) ( ntoh32 ( *( (u32 *)(p) ) ) )
+#define U16_AT(p) ( ntoh16 ( *( (u16 *)(p) ) ) )
+
+/* Alignment of critical static data structures */
+#ifdef ATTRIBUTE_ALIGNED_MAX
+# define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
+#else
+# define ATTR_ALIGN(align)
+#endif
+
+/* Alignment of critical dynamic data structure */
+#ifdef HAVE_MEMALIGN
+ /* Some systems have memalign() but no declaration for it */
+ void * memalign( size_t align, size_t size );
+#else
+# ifdef HAVE_VALLOC
+ /* That's like using a hammer to kill a fly, but eh... */
+# include <unistd.h>
+# define memalign(align,size) valloc(size)
+# else
+ /* Assume malloc alignment is sufficient */
+# define memalign(align,size) malloc(size)
+# endif
+
+
+#endif
+
+/* win32, cl and icl support */
+#if defined( _MSC_VER )
+# define __attribute__(x)
+# define __inline__ __inline
+# define strncasecmp strnicmp
+# define strcasecmp stricmp
+# define S_ISBLK(m) (0)
+# define S_ISCHR(m) (0)
+# define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
+# define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
+# define I64C(x) x##i64
+#else
+# define I64C(x) x##LL
+#endif
+
+#if defined( WIN32 )
+# if defined( __MINGW32__ )
+# if !defined( _OFF_T_ )
+typedef long long _off_t;
+typedef _off_t off_t;
+# define _OFF_T_
+# else
+# define off_t long long
+# endif
+# elif defined( _MSC_VER )
+# if !defined( _OFF_T_DEFINED )
+typedef __int64 off_t;
+# define _OFF_T_DEFINED
+# else
+# define off_t __int64
+# endif
+# endif
+# define stat _stati64
+# ifndef snprintf
+# define snprintf _snprintf /* snprintf not defined in mingw32 (bug?) */
+# endif
+#endif