File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,9 @@ func (c *C) InPos(dst []int) []int {
203203// `c` is embedded in a sequential circuit `s`, then
204204// the inputs include the latches of `s`.
205205func (c * C ) Eval (vs []bool ) {
206- for i := range c .nodes {
206+ N := len (c .nodes )
207+ vs [1 ] = true
208+ for i := 2 ; i < N ; i ++ {
207209 n := & c .nodes [i ]
208210 if n .a < 4 {
209211 continue
@@ -224,7 +226,9 @@ func (c *C) Eval(vs []bool) {
224226// Eval64 is like Eval but evaluates 64 different inputs in
225227// parallel as the bits of a uint64.
226228func (c * C ) Eval64 (vs []uint64 ) {
227- for i := range c .nodes {
229+ N := len (c .nodes )
230+ vs [1 ] = (1 << 63 ) - 1
231+ for i := 2 ; i < N ; i ++ {
228232 n := & c .nodes [i ]
229233 if n .a < 4 {
230234 continue
Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ func TestEval(t *testing.T) {
9292 if ! vs [4 ] {
9393 t .Errorf ("bad and eval" )
9494 }
95+ if ! vs [1 ] {
96+ t .Errorf ("bad const eval" )
97+ }
9598}
9699
97100var rnd = rand .New (rand .NewSource (1 ))
You can’t perform that action at this time.
0 commit comments