aboutsummaryrefslogtreecommitdiff
path: root/c/util.h
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-03 21:57:27 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-03 21:57:27 +0200
commit04daecdd21e86e7556a9462380096530228cd6ca (patch)
treeed2a8134532607687c165c4a13d6f6c020c42d18 /c/util.h
parent32bb4696396e48521614d00e5b8f6e6586822f31 (diff)
downloadEpisodeBrowser-04daecdd21e86e7556a9462380096530228cd6ca.tar.gz
Split common.h to util.h, wcharptr.h and win.h.
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