MCPcopy Create free account
hub / github.com/comaps/comaps / to_uint32

Function to_uint32

libs/base/string_utils.hpp:532–535  ·  view source on GitHub ↗

Unlike the 64-bit version, to_uint32 is not guaranteed to convert negative values. Current implementation conflates fixed-width types (uint32, uint64) with types that have no guarantees on their exact sizes (unsigned long, unsigned long long) so results of internal conversions may differ between platforms. Converting strings representing negative numbers to unsigned integers looks like a bad idea

Source from the content-addressed store, hash-verified

530// Converting strings representing negative numbers to unsigned integers looks like a bad
531// idea anyway and it's not worth changing the implementation solely for this reason.
532[[nodiscard]] inline bool to_uint32(char const * s, uint32_t & i, int base = 10)
533{
534 return internal::ToInteger(s, i, base);
535}
536
537[[nodiscard]] inline bool to_int32(char const * s, int32_t & i)
538{

Callers 3

EatFidFunction · 0.85
EatVersionFunction · 0.85
UNIT_TESTFunction · 0.85

Calls 1

ToIntegerFunction · 0.85

Tested by 1

UNIT_TESTFunction · 0.68