From 0f87f607b976820ef41fe64d004fe67dc7af8236 Mon Sep 17 00:00:00 2001 From: Joe Ramsay Date: Thu, 5 Jan 2023 11:56:20 +0000 Subject: Rewrite two abs masks as literals These were technically undefined behaviour - they have been rewritten without the shift so that their type is unsigned int by default. --- math/logf.c | 2 +- pl/math/log10f.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/math/logf.c b/math/logf.c index ea378d6..a1cd2d7 100644 --- a/math/logf.c +++ b/math/logf.c @@ -57,7 +57,7 @@ logf (float x) tmp = ix - OFF; i = (tmp >> (23 - LOGF_TABLE_BITS)) % N; k = (int32_t) tmp >> 23; /* arithmetic shift */ - iz = ix - (tmp & 0x1ff << 23); + iz = ix - (tmp & 0xff800000); invc = T[i].invc; logc = T[i].logc; z = (double_t) asfloat (iz); diff --git a/pl/math/log10f.c b/pl/math/log10f.c index 32de42f..5813982 100644 --- a/pl/math/log10f.c +++ b/pl/math/log10f.c @@ -67,7 +67,7 @@ log10f (float x) tmp = ix - OFF; i = (tmp >> (23 - LOGF_TABLE_BITS)) % N; k = (int32_t) tmp >> 23; /* arithmetic shift. */ - iz = ix - (tmp & 0x1ff << 23); + iz = ix - (tmp & 0xff800000); invc = T[i].invc; logc = T[i].logc; z = (double_t) asfloat (iz); -- cgit v1.2.3