aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Ramsay <Joe.Ramsay@arm.com>2023-01-05 11:56:20 +0000
committerJoe Ramsay <joe.ramsay@arm.com>2023-01-05 11:56:20 +0000
commit0f87f607b976820ef41fe64d004fe67dc7af8236 (patch)
tree6b81e559865db95745edc4d7f421aa242fa03d96
parent49d283240e503a412ae85cd5b60f323797f7b897 (diff)
downloadarm-optimized-routines-0f87f607b976820ef41fe64d004fe67dc7af8236.tar.gz
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.
-rw-r--r--math/logf.c2
-rw-r--r--pl/math/log10f.c2
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);