From 04f1ef728faf99123e2e93022198c6578587aaf7 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sun, 31 Dec 2023 14:41:26 -0800 Subject: [PATCH] nodeFromSymbol() --- state/state.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/state/state.go b/state/state.go index 2206555..5cd3167 100644 --- a/state/state.go +++ b/state/state.go @@ -50,7 +50,7 @@ func (st State) Clone() *State { // Returns old index func (st *State) IncrementSymbol(symbol byte) int { - node := st.bySymbol[symbol] + node := st.nodeFromSymbol(symbol) node.count++ origIndex := node.index @@ -85,3 +85,7 @@ func (st State) String() string { return strings.Join(strs, ", ") } + +func (st State) nodeFromSymbol(symbol byte) *node { + return st.bySymbol[symbol] +}