aboutsummaryrefslogtreecommitdiff
path: root/c/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/util.h')
-rw-r--r--c/util.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/c/util.h b/c/util.h
new file mode 100644
index 0000000..babe0c5
--- /dev/null
+++ b/c/util.h
@@ -0,0 +1,19 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <memory>
+
+template<size_t N, typename... T>
+inline int Swprintf(wchar_t (&buf)[N], const wchar_t* const fmt, T... xs)
+{
+ return _snwprintf_s(buf, N, _TRUNCATE, fmt, xs...);
+}
+
+inline int Cmp(const int a, const int b)
+{
+ if (a == b) return 0;
+ if (a > b) return 1;
+ return -1;
+}
+
+#endif