Some simple information syncing
This commit is contained in:
@@ -262,11 +262,30 @@ def atoll(src: str) -> t.CInt64T:
|
||||
s += 1
|
||||
elif s[0] == '+':
|
||||
s += 1
|
||||
for ch in s:
|
||||
if ch < '0' or ch > '9': break
|
||||
d: t.CInt = ch - '0'
|
||||
digit: t.CInt64T = t.CInt64T(d)
|
||||
num = num * 10 + digit
|
||||
# 十六进制前缀 0x / 0X
|
||||
is_hex: t.CInt = 0
|
||||
if s[0] == '0' and (s[1] == 'x' or s[1] == 'X'):
|
||||
is_hex = 1
|
||||
s += 2
|
||||
if is_hex:
|
||||
for ch in s:
|
||||
d: t.CInt = 0
|
||||
if ch >= '0' and ch <= '9':
|
||||
d = ch - '0'
|
||||
elif ch >= 'a' and ch <= 'f':
|
||||
d = ch - 'a' + 10
|
||||
elif ch >= 'A' and ch <= 'F':
|
||||
d = ch - 'A' + 10
|
||||
else:
|
||||
break
|
||||
digit: t.CInt64T = t.CInt64T(d)
|
||||
num = num * 16 + digit
|
||||
else:
|
||||
for ch in s:
|
||||
if ch < '0' or ch > '9': break
|
||||
d: t.CInt = ch - '0'
|
||||
digit: t.CInt64T = t.CInt64T(d)
|
||||
num = num * 10 + digit
|
||||
return num * sign
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user