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 -----------------------------------------------------------------------
|
-- Logic -----------------------------------------------------------------------
|
||||||
|
|
||||||
zeroV :: TValue -> Value
|
zeroV :: forall b w
|
||||||
|
. BitWord b w
|
||||||
|
=> TValue
|
||||||
|
-> GenValue b w
|
||||||
zeroV ty
|
zeroV ty
|
||||||
|
|
||||||
-- bits
|
-- bits
|
||||||
| isTBit ty =
|
| isTBit ty =
|
||||||
VBit False
|
VBit (bitLit False)
|
||||||
|
|
||||||
-- sequences
|
-- sequences
|
||||||
| Just (n,ety) <- isTSeq ty =
|
| Just (n,ety) <- isTSeq ty =
|
||||||
case numTValue n of
|
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)
|
| otherwise -> mkSeq n ety (SeqMap $ \_ -> ready $ zeroV ety)
|
||||||
Inf -> mkSeq n ety (SeqMap $ \_ -> ready $ zeroV ety)
|
Inf -> mkSeq n ety (SeqMap $ \_ -> ready $ zeroV ety)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user