lg2 -> width

This commit is contained in:
Dylan McNamee 2015-04-20 10:00:25 -07:00
parent 58bb7254da
commit f12f7d82eb
2 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ all : {n} (fin n) => [n] -> Bit
all xs = xs == ~zero
// "population count" - how many bits are on
popCount : {a,b} (fin a, b >= 1, b == (lg2 a)) => [a] -> [b]
popCount : {a,b} (fin a, b >= 1, b == (width a)) => [a] -> [b]
popCount bs = ic ! 0 where
ic = [0] # [ if elt then prev + 1 else prev | elt <- bs | prev <- ic]

View File

@ -12,7 +12,7 @@ type Board = [7][7]Bit
all : {n} (fin n) => [n] -> Bit
all xs = xs == ~zero
popCount : {a,b} (fin a, b >= 1, b == (lg2 a)) => [a] -> [b]
popCount : {a,b} (fin a, b >= 1, b == (width a)) => [a] -> [b]
popCount bs = ic ! 0 where
ic = [0] # [ if elt then prev + 1 else prev | elt <- bs | prev <- ic]