ppm_model.go
func (c *context) expandStates() []state {
	states := c.states()
	ns := len(states)
	if ns == 1 {
		s := states[0]
		n := c.a.allocUnits(1)
		if n == 0 {
			return nil
		}
		c.setStatesIndex(n)
		states = c.a.states[n:]
		states[0] = s
	} else if ns&0x1 == 0 {
		u := ns >> 1
		i1 := units2Index[u]
		i2 := units2Index[u+1]
		if i1 != i2 {
			n := c.a.allocUnits(i2)
			if n == 0 {
				return nil
			}
			copy(c.a.states[n:], states)
			c.a.addFreeBlock(c.statesIndex(), i1)
			c.setStatesIndex(n)
			states = c.a.states[n:]
		}
	}
	c.setNumStates(ns + 1)
	return states[:ns+1]
}
func (c *context) expandStates() []state {
	states := c.states()
	ns := len(states)
	if ns == 1 {
		s := states[0]
		n := c.a.allocUnits(1)
		if n == 0 {
			return nil
		}
		c.setStatesIndex(n)
		states = c.a.states[n:]
		states[0] = s
	} else if ns&0x1 == 0 {
		u := ns >> 1
		i1 := units2Index[u]
		i2 := units2Index[u+1]
		if i1 != i2 {
			n := c.a.allocUnits(i2)
			if n == 0 {
				return nil
			}
			copy(c.a.states[n:], states)
			c.a.addFreeBlock(c.statesIndex(), i1)
			c.setStatesIndex(n)
			states = c.a.states[n:]
		}
	}
	c.setNumStates(ns + 1)
	return states[:ns+1]
}
// expandStates expands the states list by one