[Git][ghc/ghc][master] JS: better implementation for plusWord64 (#23597)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Jul 18 01:14:49 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
b55a8ea7 by Sylvain Henry at 2023-07-17T21:14:27-04:00
JS: better implementation for plusWord64 (#23597)

- - - - -


1 changed file:

- rts/js/arith.js


Changes:

=====================================
rts/js/arith.js
=====================================
@@ -60,11 +60,11 @@ function h$hs_minusWord64(h1,l1,h2,l2) {
 }
 
 function h$hs_plusWord64(h1,l1,h2,l2) {
-  var a = W64(h1,l1);
-  var b = W64(h2,l2);
-  var r = BigInt.asUintN(64, a + b);
-  TRACE_ARITH("Word64: " + a + " + " + b + " ==> " + r)
-  RETURN_W64(r);
+  var l  = l1+l2;
+  var rl = l>>>0;
+  var rh = (h1+h2+(l!=rl?1:0))>>>0;
+  TRACE_ARITH("Word64: " + (h1,l1) + " + " + (h2,l2) + " ==> " + (rh,rl))
+  RETURN_UBX_TUP2(rh,rl);
 }
 
 function h$hs_timesInt64(h1,l1,h2,l2) {



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b55a8ea70424032c19ef85ef95c5eee8b50d55c3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b55a8ea70424032c19ef85ef95c5eee8b50d55c3
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230717/95165fd2/attachment-0001.html>


More information about the ghc-commits mailing list