I guess you could use fewer magic numbers if you want, for example instead of:
proc createCRCTable(): array[256, CRC32] =
for i in 0..255:
You can write: proc createCRCTable(): array[256, CRC32] =
for i in result.low .. result.high:
Or: proc createCRCTable(): array[256, CRC32] =
for i, v in result: # index, value
Or define your own indices iterator: iterator indices(x) =
for i in x.low .. x.high:
yield i
proc createCRCTable(): array[256, CRC32] =
for i in result.indices:
I think I should propose adding indices to the standard library.