]> Savannah Git Hosting - gnulib.git/commit
timespec-add,timespec-sub: tune
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 15 Jun 2024 06:11:05 +0000 (23:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 15 Jun 2024 06:12:23 +0000 (23:12 -0700)
commitfe33f943054b93af8b965ce6564b8713b0979a21
tree95ee9becfea27522399b72dcfd64ac00634d6728
parent790206bfe741d1280b0b5734a0d4070b26a885ab
timespec-add,timespec-sub: tune

* lib/timespec-add.c (timespec_add):
* lib/timespec-sub.c (timespec_sub):
Simplify by detecting overflow when the two overflow bits of the
underlying operation differ.  This avoids some gotos and labels
and conditional branches; GCC 14 x86-64 now generates just one
conditional branch for the resulting code.  Idea stolen from
my recent changes to the glibc manual’s time chapter.
* modules/timespec-add (Depends-on):
* modules/timespec-sub (Depends-on): Add stdbool.
ChangeLog
lib/timespec-add.c
lib/timespec-sub.c
modules/timespec-add
modules/timespec-sub