minor code cleanups (#21215)

This commit is contained in:
Andreas Rumpf
2023-01-02 10:39:17 +01:00
committed by GitHub
parent e9ed090c33
commit cf1b16ef8b
6 changed files with 32 additions and 36 deletions

View File

@@ -112,9 +112,9 @@ const invalidSlot = uint8.high
proc genLookup[T: typedesc[HoleyEnum]](_: T): auto =
const n = span(T)
var ret: array[n, uint8]
var i = 0
assert n <= invalidSlot.int
var ret {.noinit.}: array[n, uint8]
for ai in mitems(ret): ai = invalidSlot
for ai in items(T):
ret[ai.ord - T.low.ord] = uint8(i)