diff --git a/util/test/demos/test_common.h b/util/test/demos/test_common.h index c400418d9..60efee890 100644 --- a/util/test/demos/test_common.h +++ b/util/test/demos/test_common.h @@ -256,6 +256,18 @@ std::string GetEnvVar(const char *var); #define RANDF(mn, mx) ((float(rand()) / float(RAND_MAX)) * ((mx) - (mn)) + (mn)) +template +inline T AlignUp(T x, T a) +{ + return (x + (a - 1)) & (~(a - 1)); +} + +template +inline T AlignUpPtr(T x, A a) +{ + return (T)AlignUp((uintptr_t)x, (uintptr_t)a); +} + std::string strlower(const std::string &str); std::string strupper(const std::string &str); std::string trim(const std::string &str);