From 1b51f0edf45a3e1864389b96e995f7cea5a232e2 Mon Sep 17 00:00:00 2001 From: Rob Dockins Date: Sun, 15 May 2016 22:34:06 -0700 Subject: [PATCH] generalize the 'zero' operation --- src/Cryptol/Prims/Eval.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Cryptol/Prims/Eval.hs b/src/Cryptol/Prims/Eval.hs index ebfd63ad..3f6e63a9 100644 --- a/src/Cryptol/Prims/Eval.hs +++ b/src/Cryptol/Prims/Eval.hs @@ -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)