summaryrefslogtreecommitdiff
path: root/kernel/inc/macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/inc/macros.h')
-rw-r--r--kernel/inc/macros.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/kernel/inc/macros.h b/kernel/inc/macros.h
new file mode 100644
index 0000000..21340ad
--- /dev/null
+++ b/kernel/inc/macros.h
@@ -0,0 +1,43 @@
+//+----------------------------------------------------------------------------
+//
+// File: macros.h
+//
+// Module:
+//
+// Synopsis:
+//
+// Copyright (C) 2003
+//
+// Created: sgasch 10 Oct 2003
+//
+//+----------------------------------------------------------------------------
+
+#ifndef _MACROS_H_
+#define _MACROS_H_
+
+//
+// Macros
+//
+#define ARRAY_LENGTH(a) (sizeof((a)) / sizeof((a)[0]))
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#define MAX(x, y) (((x) > (y)) ? (x) : (y))
+
+#if 1
+void _assert(CHAR *, CHAR *, ULONG);
+void VideoPrint(CHAR *, ...);
+#define ASSERT(x) if (x) \
+ { ; } \
+ else \
+ { _assert(__FUNCTION__ , \
+ __FILE__ , \
+ __LINE__); }
+#define TRACE(f, ...) VideoPrint("%s:%u> " ##f , __FUNCTION__ , \
+ __LINE__ , ##__VA_ARGS__)
+#else
+#define ASSERT(x) ;
+#define TRACE(f, ...) ;
+#endif // DEBUG
+
+#define CURRENT_STAMP(a) asm volatile("rdtsc" : "=a"(((unsigned int *)(a))[0]), "=d"(((unsigned int *)a)[1]))
+
+#endif /* _MACROS_H_ */