github.com/jflude/taocp@v0.0.0-20240210234939-99f2a91af3c2/mix/compare.go (about) 1 package mix 2 3 func (c *Computer) cmpa(aa Word, i, f, op, m int) (int64, error) { 4 c.checkInterlock(m, m) 5 if op == CMPA && f == 6 { 6 c.Comparison = CompareFloatWord(c.Reg[A], c.Contents[mBase+m]) 7 return 4, nil 8 } 9 reg := c.Reg[op-CMPA].Field(f).Int() 10 mem := c.Contents[mBase+m].Field(f).Int() 11 if reg < mem { 12 c.Comparison = Less 13 } else if reg > mem { 14 c.Comparison = Greater 15 } else { 16 c.Comparison = Equal 17 } 18 return 2, nil 19 }