diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-10-22 14:34:08 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-10-27 17:25:12 +0000 |
commit | 9459d9d8112fe7816022665b5016c2014bb625f3 (patch) | |
tree | 80486d9f4331e149f6e7ef7381acbac1613ffb31 /src/factor.c | |
parent | 6796698c9945d87236ffcc939137d0919ef04931 (diff) | |
download | coreutils-9459d9d8112fe7816022665b5016c2014bb625f3.tar.xz |
copy,dd: simplify and optimize NUL bytes detection
* src/factor.c: Move LIKELY() definition to...
* src/system.h: ...here.
(is_nul): Reimplement with a version that doesn't
require a sentinel after the buffer, and which calls
down to (the system optimized) memcmp.
Performance analyzed at http://rusty.ozlabs.org/?p=560
* src/dd.c (alloc_obuf): Simplify the is_nul() call by
not needing to write the sentinel.
* src/copy.c (sparse_copy): Likewise.
(copy_reg): Simplify the buffer allocation by avoiding
consideration of the sentinel in the buffer size calculation.
Diffstat (limited to 'src/factor.c')
-rw-r--r-- | src/factor.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/src/factor.c b/src/factor.c index e4ce4a5ea..ee578bfe5 100644 --- a/src/factor.c +++ b/src/factor.c @@ -705,14 +705,6 @@ static bool flag_prove_primality = PROVE_PRIMALITY; /* Number of Miller-Rabin tests to run when not proving primality. */ #define MR_REPS 25 -#ifdef __GNUC__ -# define LIKELY(cond) __builtin_expect ((cond), 1) -# define UNLIKELY(cond) __builtin_expect ((cond), 0) -#else -# define LIKELY(cond) (cond) -# define UNLIKELY(cond) (cond) -#endif - static void factor_insert_refind (struct factors *factors, uintmax_t p, unsigned int i, unsigned int off) |