parseNoGC can work with code points directly.
This commit is contained in:
parent
6e1239fdac
commit
cac25207f1
|
@ -33,10 +33,15 @@ body
|
|||
Target v = 0;
|
||||
size_t atStart = true;
|
||||
|
||||
for (; !s.empty; s.popFront())
|
||||
// We can safely foreach over individual code points.
|
||||
// Even with UTF-8 any digit is ASCII and anything not ASCII (such as the start of
|
||||
// a UTF-8 sequence) is not a digit.
|
||||
foreach(i; 0 .. s.length)
|
||||
{
|
||||
uint c = s.front;
|
||||
if (c < '0')
|
||||
dchar c = s[i];
|
||||
// We can just take a char instead of decoding because anything non-ASCII is not
|
||||
// going to be a decodable digit, i.e. we will end at such a byte.
|
||||
if (c < '0' || c >= 0x80)
|
||||
break;
|
||||
if (radix < 10)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue