fixed

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

commit 6efff72c59073a7ba1041dd4f8bbbbe5e10ccf97
parent 1dc440f55569398fb62484ddb85475e129dbcb4b
Author: Jared Tobin <jared@jtobin.io>
Date:   Sat, 15 Nov 2025 07:41:41 +0400

lib: wide add/mul optimization

Diffstat:
Mlib/Data/Word/Wide.hs | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/Data/Word/Wide.hs b/lib/Data/Word/Wide.hs @@ -166,7 +166,7 @@ add_c# -> (# Word#, Word# #) -- ^ addend -> (# (# Word#, Word# #), Word# #) -- ^ (# sum, carry bit #) add_c# (# a0, a1 #) (# b0, b1 #) = - let !(# s0, c0 #) = L.add_c# a0 b0 0## + let !(# c0, s0 #) = plusWord2# a0 b0 !(# s1, c1 #) = L.add_c# a1 b1 c0 in (# (# s0, s1 #), c1 #) {-# INLINE add_c# #-} @@ -222,8 +222,8 @@ mul_w# (# a0, a1 #) (# b0, b1 #) = let !(# p0_lo, p0_hi #) = L.mul_c# a0 b0 !(# p1_lo, _ #) = L.mul_c# a0 b1 !(# p2_lo, _ #) = L.mul_c# a1 b0 - !(# s0, _ #) = L.add_c# p0_hi p1_lo 0## - !(# s1, _ #) = L.add_c# s0 p2_lo 0## + !(# _, s0 #) = plusWord2# p0_hi p1_lo + !(# _, s1 #) = plusWord2# s0 p2_lo in (# p0_lo, s1 #) {-# INLINE mul_w# #-}