diff options
Diffstat (limited to 'src/utils.h')
| -rw-r--r-- | src/utils.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h index 00be767..5a47c44 100644 --- a/src/utils.h +++ b/src/utils.h @@ -77,6 +77,8 @@ static inline u32 wayc_min(u32 a, u32 b) { return a > b ? a : b; } #define WAYC_X(v) ((v)[0]) #define WAYC_Y(v) ((v)[1]) +#define WAYC_TRIANGLE_NVERTS 3 + static inline usize wayc_max(usize a, usize b) { return a > b ? a : b; } template <typename A, typename B> @@ -117,3 +119,21 @@ struct defer_cond_s { #define wayc_defer_cond(func, cond, expected) \ auto WAYC_UNIQUE(_defer_) = defer_cond_s([&]() { func; }, &cond, expected) + +struct string_s { + char* data; + usize length; +}; + +#define WAYC_STRING_INIT(str, len) \ + string_s { str, len } + +static inline usize wayc_string_length(const struct string_s* str) { + wayc_notnull(str); + return str->length; +} + +static inline char* wayc_string_data(const struct string_s* str) { + wayc_notnull(str); + return str->data; +}
\ No newline at end of file |
