This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: [PATCH] libm round - fix for 16-bit CPU
- From: "Jon Beniston" <jon at beniston dot com>
- To: "'Craig Howland'" <howland at LGSInnovations dot com>, <newlib at sourceware dot org>
- Date: Wed, 20 Jun 2018 20:47:24 +0100
- Subject: RE: [PATCH] libm round - fix for 16-bit CPU
- References: <000301d408b0$61a6e1a0$24f4a4e0$@beniston.com> <2d130fcc-c1bb-2f58-566a-fc5bb2c1b522@LGSInnovations.com>
Hi Craig,
>Might it be slightly better to use a cast with the type of msw?
Yep.
From: Jon Beniston <jon@beniston.com>
Date: Wed, 20 Jun 2018 20:45:01 +0100
Subject: [PATCH] libm/common/s_round.c (round): Add cast for 16-bit CPUs
---
newlib/libm/common/s_round.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/newlib/libm/common/s_round.c b/newlib/libm/common/s_round.c
index f0926d85f..e3a91d6c2 100644
--- a/newlib/libm/common/s_round.c
+++ b/newlib/libm/common/s_round.c
@@ -68,7 +68,7 @@ SEEALSO
msw &= 0x80000000;
if (exponent_less_1023 == -1)
/* Result is +1.0 or -1.0. */
- msw |= (1023 << 20);
+ msw |= ((__int32_t)1023 << 20);
lsw = 0;
}
else
--
2.15.1