Skip to content

Commit 058de4d

Browse files
authored
Merge pull request #107 from leonschoorl/fix-maxBound_Index_0
Add a bounds check to Index.maxBound#
2 parents 0fcb8c9 + adf476a commit 058de4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/CLaSH/Sized/Internal/Index.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ instance KnownNat n => Bounded (Index n) where
196196

197197
{-# NOINLINE maxBound# #-}
198198
maxBound# :: KnownNat n => Index n
199-
maxBound# = let res = I (natVal res - 1) in res
199+
maxBound# = let res = fromInteger_INLINE (natVal res - 1) in res
200200

201201
-- | Operators report an error on overflow and underflow
202202
instance KnownNat n => Num (Index n) where

0 commit comments

Comments
 (0)