mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-12-17 04:44:39 +03:00
generalize the 'zero' operation
This commit is contained in:
parent
da4a458aed
commit
1b51f0edf4
@ -473,17 +473,20 @@ funCmp op =
|
||||
|
||||
-- Logic -----------------------------------------------------------------------
|
||||
|
||||
zeroV :: TValue -> Value
|
||||
zeroV :: forall b w
|
||||
. BitWord b w
|
||||
=> TValue
|
||||
-> GenValue b w
|
||||
zeroV ty
|
||||
|
||||
-- bits
|
||||
| isTBit ty =
|
||||
VBit False
|
||||
VBit (bitLit False)
|
||||
|
||||
-- sequences
|
||||
| Just (n,ety) <- isTSeq ty =
|
||||
case numTValue n of
|
||||
Nat w | isTBit ety -> word w 0
|
||||
Nat w | isTBit ety -> VWord $ wordLit w 0
|
||||
| otherwise -> mkSeq n ety (SeqMap $ \_ -> ready $ zeroV ety)
|
||||
Inf -> mkSeq n ety (SeqMap $ \_ -> ready $ zeroV ety)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user