aboutsummaryrefslogtreecommitdiff
path: root/include/irrpack.h
diff options
context:
space:
mode:
authorcutealien <cutealien@dfc29bdd-3216-0410-991c-e03cc46cb475>2020-01-03 19:05:16 +0000
committercutealien <cutealien@dfc29bdd-3216-0410-991c-e03cc46cb475>2020-01-03 19:05:16 +0000
commit2ae2a551a6290f46734307bbfdafea4b1a2cf2ba (patch)
treeba2f0b468640e44899fed3df2d4cc58795f4a003 /include/irrpack.h
downloadirrlicht-2ae2a551a6290f46734307bbfdafea4b1a2cf2ba.tar.xz
Merging r5975 through r6036 from trunk to ogl-es branch.
GLES drivers adapted, but only did make compile-tests. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6038 dfc29bdd-3216-0410-991c-e03cc46cb475
Diffstat (limited to 'include/irrpack.h')
-rw-r--r--include/irrpack.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/irrpack.h b/include/irrpack.h
new file mode 100644
index 0000000..ff922d0
--- /dev/null
+++ b/include/irrpack.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2007-2012 Nikolaus Gebhardt
+// This file is part of the "Irrlicht Engine".
+// For conditions of distribution and use, see copyright notice in irrlicht.h
+
+// include this file right before the data structures to be 1-aligned
+// and add to each structure the PACK_STRUCT define just like this:
+// struct mystruct
+// {
+// ...
+// } PACK_STRUCT;
+// Always include the irrunpack.h file right after the last type declared
+// like this, and do not put any other types with different alignment
+// in between!
+
+// byte-align structures
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
+# pragma warning(disable: 4103)
+# pragma pack( push, packing )
+# pragma pack( 1 )
+# define PACK_STRUCT
+#elif defined( __DMC__ )
+# pragma pack( push, 1 )
+# define PACK_STRUCT
+#elif defined( __GNUC__ )
+ // Using pragma pack might work with earlier gcc versions already, but
+ // it started to be necessary with gcc 4.7 on mingw unless compiled with -mno-ms-bitfields.
+ // And I found some hints on the web that older gcc versions on the other hand had sometimes
+ // trouble with pragma pack while they worked with __attribute__((packed)).
+# if (__GNUC__ > 4 ) || ((__GNUC__ == 4 ) && (__GNUC_MINOR__ >= 7))
+# pragma pack( push, packing )
+# pragma pack( 1 )
+# define PACK_STRUCT
+# else
+# define PACK_STRUCT __attribute__((packed))
+ #endif
+#else
+# error compiler not supported
+#endif
+