+
+ // If we're already out of range, keep eating
+ if( ret == ULLONG_MAX ) {
+ errno = ERANGE;
+ str ++;
+ // Keep eating until first unrecognised character
+ continue;
+ }
+
+ // Rough then accurate check against max value
+ if( ret >= max_before_ullong_max )
+ {
+ //_SysDebug("strtoull - 0x%llx>0x%llx", ret, max_before_ullong_max);
+ if( (ret - max_before_ullong_max) * base + next > space_above ) {
+ //_SysDebug("strtoull - %u*%u+%u (%u) > %u",
+ // (unsigned int)(ret - max_before_ullong_max), base, next, space_above);
+ ret = ULLONG_MAX;
+ errno = ERANGE;
+ str ++;
+ continue;
+ }
+ }