Lodestone.Common
Loading...
Searching...
No Matches
Util.h
Go to the documentation of this file.
1//
2// Created by DexrnZacAttack on 2/15/26 using zPc-i2.
3//
4#ifndef LODESTONE_UTIL_H
5#define LODESTONE_UTIL_H
6#include <cstring>
7
9 class Util {
10 public:
11 Util() = delete;
12
13#define SWITCH_STRING(s) switch(lodestone::common::util::Math::fnv1a64(s))
14
15 static constexpr bool strcmpConstexpr(const char *lhs, const char *rhs) {
16 while (*lhs || *rhs) {
17 if (*lhs++ != *rhs++)
18 return false;
19 }
20
21 return true;
22 }
23
24 static constexpr size_t strlenConstexpr(const char *s) {
25 size_t l = 0;
26 while (*s++) {
27 ++l;
28 }
29
30 return l;
31 }
32
33 template <size_t Len>
34 static consteval size_t strlenCompileTime(const char (&)[Len]) {
35 return Len-1;
36 }
37
38 static unsigned long long getCurrentTimeMillis();
39 };
40}
41
42#endif // LODESTONE_UTIL_H
static constexpr size_t strlenConstexpr(const char *s)
Definition Util.h:24
static unsigned long long getCurrentTimeMillis()
Definition Util.cpp:8
static constexpr bool strcmpConstexpr(const char *lhs, const char *rhs)
Definition Util.h:15
static consteval size_t strlenCompileTime(const char(&)[Len])
Definition Util.h:34
Definition Casts.cpp:10