mirror of
https://github.com/bkaradzic/bx.git
synced 2026-06-08 03:03:48 +00:00
StringView constexpr. (#351)
This commit is contained in:
committed by
GitHub
parent
0e221f9844
commit
808aa150f8
10
src/dtoa.cpp
10
src/dtoa.cpp
@@ -1093,7 +1093,7 @@ namespace bx
|
||||
return true;
|
||||
}
|
||||
|
||||
bool fromString(int32_t* _out, const StringView& _str)
|
||||
bool fromString(long long* _out, const StringView& _str)
|
||||
{
|
||||
StringView str = strLTrimSpace(_str);
|
||||
|
||||
@@ -1113,7 +1113,7 @@ namespace bx
|
||||
break;
|
||||
}
|
||||
|
||||
int32_t result = 0;
|
||||
long long result = 0;
|
||||
|
||||
for (ch = *ptr++; isNumeric(ch) && ptr <= term; ch = *ptr++)
|
||||
{
|
||||
@@ -1125,10 +1125,4 @@ namespace bx
|
||||
return true;
|
||||
}
|
||||
|
||||
bool fromString(uint32_t* _out, const StringView& _str)
|
||||
{
|
||||
fromString( (int32_t*)_out, _str);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace bx
|
||||
|
||||
@@ -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!");
|
||||
|
||||
Reference in New Issue
Block a user