StringView constexpr. (#351)

This commit is contained in:
Branimir Karadžić
2025-11-22 18:41:54 -08:00
committed by GitHub
parent 0e221f9844
commit 808aa150f8
8 changed files with 281 additions and 138 deletions

View File

@@ -165,7 +165,7 @@ namespace bx
typedef char (*CharFn)(char _ch);
inline char toNoop(char _ch)
inline constexpr char toNoop(char _ch)
{
return _ch;
}
@@ -290,18 +290,6 @@ namespace bx
);
}
int32_t strLen(const char* _str, int32_t _max)
{
if (NULL == _str)
{
return 0;
}
const char* ptr = _str;
for (; 0 < _max && *ptr != '\0'; ++ptr, --_max) {};
return int32_t(ptr - _str);
}
inline int32_t strCopy(char* _dst, int32_t _dstSize, const char* _src, int32_t _num)
{
BX_ASSERT(NULL != _dst, "_dst can't be NULL!");