]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
factor: tune submod2
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 2 Jul 2025 21:46:00 +0000 (14:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 10 Jul 2025 00:12:40 +0000 (17:12 -0700)
* src/factor.c (submod2): Use ckd_sub to subtract by hand rather
than using sub_ddmmss plus a compare.  This speeds things up a
bit, on x86-64 with GCC 15 anyway.

src/factor.c

index cdb31dda0b13eb885fcb599edc24309cc5cdfeb5..79eeabe8295ffc5943e5f487ae8c5eb559d8e059 100644 (file)
@@ -428,8 +428,9 @@ gt2 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl)
   } while (0)
 #define submod2(r1, r0, a1, a0, b1, b0, n1, n0)                         \
   do {                                                                  \
-    sub_ddmmss (r1, r0, a1, a0, b1, b0);                               \
-    if ((r1) >> (W_TYPE_SIZE - 1) != 0)                                        \
+    bool _v1 = ckd_sub (&(r1), a1, b1);                                        \
+    mp_limb_t _v0 = ckd_sub (&(r0), a0, b0);                           \
+    if (_v1 | ckd_sub (&(r1), r1, _v0))                                        \
       add_ssaaaa (r1, r0, r1, r0, n1, n0);                             \
   } while (0)