Dynamic code generation

This commit is contained in:
Ian Gulliver
2023-12-31 19:24:17 -08:00
parent 2f88ac2708
commit 01731ffb4f
4 changed files with 82 additions and 344 deletions

View File

@@ -16,7 +16,7 @@ func Encode(st *state.State, msg []byte) []byte {
for i := 0; i < len(msg); {
l, index := st.IncrementSymbol(msg[i:])
i += l
code := codes.CodeForIndex(index)
code := codes.CodeForIndex(uint32(index))
lo.Must0(w.WriteBits(uint64(code.Value), uint8(code.Bits)))
}