new .rod file implementation; part 1: writing of the file

This commit is contained in:
Araq 2018-02-15 15:42:14 +01:00
commit f3b8d92216
8 changed files with 594 additions and 8 deletions

View file

@ -67,6 +67,8 @@ proc decodeStr*(s: cstring, pos: var int): string =
const
chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
{.push overflowChecks: off.}
# since negative numbers require a leading '-' they use up 1 byte. Thus we
# subtract/add `vintDelta` here to save space for small negative numbers
# which are common in ROD files:
@ -131,6 +133,8 @@ proc decodeVInt*(s: cstring, pos: var int): int =
proc decodeVBiggestInt*(s: cstring, pos: var int): BiggestInt =
decodeIntImpl()
{.pop.}
iterator decodeVIntArray*(s: cstring): int =
var i = 0
while s[i] != '\0':