summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-11-20 13:25:44 -0500
committerGitHub <noreply@github.com>2019-11-20 13:25:44 -0500
commit8a7e729632a9c7e9f0fa84e3686904bd0cc2ecc5 (patch)
tree1540d7c35a3674977a07f5a1c34a058244494ca0 /source/core
parentfae3d9ae91a24e59ce6ec64b8a1217fa81f5acee (diff)
Added -ir-compression & fixes for ir compression issues (#1129)
* Added ir-compression option. * Fix issues around ir-compression. * Fix typo in test name.
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-riff.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/core/slang-riff.h b/source/core/slang-riff.h
index 1622f60f4..535eaffc2 100644
--- a/source/core/slang-riff.h
+++ b/source/core/slang-riff.h
@@ -12,9 +12,26 @@ namespace Slang
// http://fileformats.archiveteam.org/wiki/RIFF
// http://www.fileformat.info/format/riff/egff.htm
+
typedef uint32_t FourCC;
-#define SLANG_FOUR_CC(c0, c1, c2, c3) FourCC((uint32_t(c0) << 0) | (uint32_t(c1) << 8) | (uint32_t(c2) << 16) | (uint32_t(c3) << 24))
+/* Use of macros to construct and extract from FourCC means the FourCC ordering can be fixed for endian differences. */
+
+#if SLANG_LITTLE_ENDIAN
+
+#define SLANG_FOUR_CC(c0, c1, c2, c3) ((FourCC(c0) << 0) | (FourCC(c1) << 8) | (FourCC(c2) << 16) | (FourCC(c3) << 24))
+
+#define SLANG_FOUR_CC_GET_FIRST_CHAR(x) char((x) & 0xff)
+#define SLANG_FOUR_CC_REPLACE_FIRST_CHAR(x, c) (((x) & 0xffffff00) | FourCC(c))
+
+#else
+
+#define SLANG_FOUR_CC(c0, c1, c2, c3) ((FourCC(c0) << 24) | (FourCC(c1) << 16) | (FourCC(c2) << 8) | (FourCC(c3) << 0))
+
+#define SLANG_FOUR_CC_GET_FIRST_CHAR(x) char((x) >> 24)
+#define SLANG_FOUR_CC_REPLACE_FIRST_CHAR(x, c) (((x) & 0x00ffffff) | (FourCC(c) << 24))
+
+#endif
enum
{