summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mfluadir/otfcc/lib/support/tag.h
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/mfluadir/otfcc/lib/support/tag.h')
-rw-r--r--Build/source/texk/web2c/mfluadir/otfcc/lib/support/tag.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/mfluadir/otfcc/lib/support/tag.h b/Build/source/texk/web2c/mfluadir/otfcc/lib/support/tag.h
new file mode 100644
index 00000000000..e2a339d3b61
--- /dev/null
+++ b/Build/source/texk/web2c/mfluadir/otfcc/lib/support/tag.h
@@ -0,0 +1,36 @@
+#ifndef CARYLL_SUPPORT_TAG_H
+#define CARYLL_SUPPORT_TAG_H
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifndef INLINE
+#ifdef _MSC_VER
+#define INLINE __forceinline /* use __forceinline (VC++ specific) */
+#else
+#define INLINE inline /* use standard inline */
+#endif
+#endif
+
+// Tag handler
+static INLINE void tag2str(uint32_t tag, char tags[4]) {
+ tags[0] = (tag >> 24) & 0xFF;
+ tags[1] = (tag >> 16) & 0xFF;
+ tags[2] = (tag >> 8) & 0xFF;
+ tags[3] = tag & 0xFF;
+}
+
+static INLINE uint32_t str2tag(const char *tags) {
+ if (!tags) return 0;
+ uint32_t tag = 0;
+ uint8_t len = 0;
+ while (*tags && len < 4) {
+ tag = (tag << 8) | (*tags), tags++, len++;
+ }
+ while (len < 4) {
+ tag = (tag << 8) | ' ', len++;
+ }
+ return tag;
+}
+
+#endif