From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: [PATCH] fix fesetround error checking
Date: Wed, 26 Sep 2018 23:18:40 +0200 [thread overview]
Message-ID: <20180926211840.GI10209@port70.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 41 bytes --]
simple fix, not sure why this was wrong.
[-- Attachment #2: 0001-fix-fesetround-error-checking.patch --]
[-- Type: text/x-diff, Size: 901 bytes --]
From b9200510d08fa1b6aba8d1ee4ffbdf8892397cfa Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Mon, 10 Sep 2018 19:06:21 +0000
Subject: [PATCH] fix fesetround error checking
Rounding modes are not bit flags, but arbitrary non-negative integers.
---
src/fenv/fesetround.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/fenv/fesetround.c b/src/fenv/fesetround.c
index 50e58f11..4e2f164d 100644
--- a/src/fenv/fesetround.c
+++ b/src/fenv/fesetround.c
@@ -7,18 +7,17 @@ hidden int __fesetround(int);
int fesetround(int r)
{
- if (r & ~(
- FE_TONEAREST
+ if (r != FE_TONEAREST
#ifdef FE_DOWNWARD
- |FE_DOWNWARD
+ && r != FE_DOWNWARD
#endif
#ifdef FE_UPWARD
- |FE_UPWARD
+ && r != FE_UPWARD
#endif
#ifdef FE_TOWARDZERO
- |FE_TOWARDZERO
+ && r != FE_TOWARDZERO
#endif
- ))
+ )
return -1;
return __fesetround(r);
}
--
2.18.0
reply other threads:[~2018-09-26 21:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180926211840.GI10209@port70.net \
--to=nsz@port70.net \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).