summaryrefslogtreecommitdiff
path: root/include/glamacdef.h
diff options
context:
space:
mode:
authoradmin <contact@optics-design.com>2025-04-25 21:19:44 +0200
committeradmin <contact@optics-design.com>2025-04-25 21:19:44 +0200
commit6be3193593d6fe6dc36e584a44ec629a44fc394b (patch)
treeeec627ebb2abc443ce44b8ce8b9180f2225e13ec /include/glamacdef.h
First Commit
Diffstat (limited to 'include/glamacdef.h')
-rw-r--r--include/glamacdef.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/glamacdef.h b/include/glamacdef.h
new file mode 100644
index 0000000..13fffbf
--- /dev/null
+++ b/include/glamacdef.h
@@ -0,0 +1,37 @@
+/**
+ * glamacdef.h - header file containing various definitions for the GlaMaC.
+ *
+ * Copyright (C) 2025 https://optics-design.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * See the COPYING file for the full license text.
+ */
+#ifndef OPDECDEF_H
+#define OPDECDEF_H
+
+#include <stdint.h>
+#include <uchar.h>
+/* Type definitions for consistent sizing across platforms. Idea taken from https://nullprogram.com/blog/2023/10/08/ (archive link: ) */
+typedef uint8_t u8;
+typedef char16_t c16;
+typedef int32_t b32;
+typedef int32_t i32;
+typedef uint32_t u32;
+typedef uint64_t u64;
+typedef float f32;
+typedef double f64;
+typedef uintptr_t uptr;
+typedef char byte;
+typedef ptrdiff_t size;
+typedef size_t usize;
+/* Utility macros */
+#define countof(a) (size)(sizeof(a) / sizeof(*(a)))
+#define lengthof(s) (countof(s) - 1)
+// #define new(a, t, n) (t *)alloc(a, sizeof(t), _Alignof(t), n) //From Nullprogram, not using currently
+#define new(t, n) (t *)malloc(n*sizeof(t))
+#define new_arr(t,arr) (t)malloc(sizeof(arr))
+#endif /* OPDECDEF_H */
Back to https://optics-design.com