fixed

Pure Haskell large fixed-width integers.
git clone git://git.ppad.tech/fixed.git
Log | Files | Refs | README | LICENSE

commit fcc9667765eb2ed7ddbf9f8e71623ea1cf9c9815
parent d53a9cdc30e537b10308913256af15052394f588
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 30 Nov 2025 11:58:48 +0400

limb: other comparison ops

Diffstat:
Mlib/Data/Word/Limb.hs | 34++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+), 0 deletions(-)

diff --git a/lib/Data/Word/Limb.hs b/lib/Data/Word/Limb.hs @@ -33,7 +33,11 @@ module Data.Word.Limb ( -- * Comparison , eq# , ne# + , eq_vartime# + , ne_vartime# , nonzero# + , lt# + , gt# -- * Selection , select# @@ -82,6 +86,13 @@ eq# eq# (Limb a) (Limb b) = C.ct_eq_word# a b {-# INLINE eq# #-} +eq_vartime# + :: Limb + -> Limb + -> Bool +eq_vartime# (Limb a) (Limb b) = Exts.isTrue# (Exts.eqWord# a b) +{-# INLINE eq_vartime# #-} + -- | Inequality comparison. ne# :: Limb @@ -90,6 +101,13 @@ ne# ne# a b = C.not_c# (eq# a b) {-# INLINE ne# #-} +ne_vartime# + :: Limb + -> Limb + -> Bool +ne_vartime# a b = not (eq_vartime# a b) +{-# INLINE ne_vartime# #-} + -- | Comparison to zero. nonzero# :: Limb @@ -97,6 +115,22 @@ nonzero# nonzero# (Limb a) = C.from_word_nonzero# a {-# INLINE nonzero# #-} +-- | Less than. +lt# + :: Limb + -> Limb + -> C.Choice +lt# (Limb a) (Limb b) = C.from_word_lt# a b +{-# INLINE lt# #-} + +-- | Greater than. +gt# + :: Limb + -> Limb + -> C.Choice +gt# (Limb a) (Limb b) = C.from_word_gt# a b +{-# INLINE gt# #-} + -- selection ------------------------------------------------------------------ -- | Return a if c is truthy, otherwise return b.