make oids module better (#16704)
* make oids modules better * Update lib/pure/oids.nim * fix
This commit is contained in:
parent
d99ea00829
commit
8d3e0c7b9b
2 changed files with 45 additions and 26 deletions
|
|
@ -21,6 +21,13 @@ proc handleHexChar*(c: char, x: var int): bool {.inline.} =
|
|||
else:
|
||||
result = false
|
||||
|
||||
proc handleHexChar*(c: char): int {.inline.} =
|
||||
case c
|
||||
of '0'..'9': result = (ord(c) - ord('0'))
|
||||
of 'a'..'f': result = (ord(c) - ord('a') + 10)
|
||||
of 'A'..'F': result = (ord(c) - ord('A') + 10)
|
||||
else: discard
|
||||
|
||||
proc decodePercent*(s: openArray[char], i: var int): char =
|
||||
## Converts `%xx` hexadecimal to the character with ordinal number `xx`.
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue