Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions logic/c.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (p *C) And(a, b z.Lit) z.Lit {
return b
}
c := strashCode(a, b)
l := uint32(cap(p.nodes))
l := uint32(cap(p.nodes) - 1)
i := c % l
si := p.strash[i]
for {
Expand All @@ -282,7 +282,7 @@ func (p *C) And(a, b z.Lit) z.Lit {
m, j := p.newNode()
m.a = a
m.b = b
k := c % uint32(cap(p.nodes))
k := c % uint32(cap(p.nodes) - 1)
m.n = p.strash[k]
p.strash[k] = j
return z.Var(j).Pos()
Expand Down Expand Up @@ -367,7 +367,7 @@ func (p *C) grow() {
continue
}
c := strashCode(n.a, n.b)
j := c % ucap
j := c % (ucap - 1)
n.n = strash[j]
strash[j] = uint32(i)
}
Expand Down
7 changes: 7 additions & 0 deletions sudoku_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ package gini_test

import (
"fmt"
"testing"

"github.com/go-air/gini"
"github.com/go-air/gini/z"
)

func BenchmarkSudoku(b *testing.B) {
for i := 0; i < b.N; i++ {
Example_sudoku()
}
}

func Example_sudoku() {
g := gini.New()
// 9 rows, 9 cols, 9 boxes, 9 numbers
Expand Down