Add utils
This commit is contained in:
1 parent
aab56a7cef
commit
82710fba6b
2 files changed
+35
No files matched your search
@@ -0,0 +1,27 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include "../wapp/wapp.h"
|
||||
|
||||
#ifdef USE_RUNTIME_ASSERT
|
||||
#define baseAssert wpRuntimeAssert
|
||||
#else
|
||||
#define baseAssert wpDebugAssert
|
||||
#endif
|
||||
|
||||
#define assertWithLogger(COND, LOGGER_PTR, MSG) do { \
|
||||
WpStr8RO msg = wpStr8LitRo(MSG); \
|
||||
if (!(COND)) { wpLogError((LOGGER_PTR), msg); } \
|
||||
baseAssert(COND, MSG); \
|
||||
} while(0)
|
||||
|
||||
#define makeVersion(MAJOR, MINOR, PATCH) (wpU32Const(MAJOR) << 24 | \
|
||||
wpU32Const(MINOR) << 16 | \
|
||||
wpU32Const(PATCH))
|
||||
#define majorFromVersion(VERSION) (VERSION >> 24)
|
||||
#define minorFromVersion(VERSION) ((VERSION >> 16) & 0xff)
|
||||
#define patchFromVersion(VERSION) (VERSION & 0xffff)
|
||||
|
||||
#endif // !UTILS_H
|
||||
@@ -0,0 +1,8 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef UTILS_INC_H
|
||||
#define UTILS_INC_H
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#endif // !UTILS_INC_H
|
||||
Reference in new issue
Block a user