diff options
author | Vincent Chen <vincentc@andestech.com> | 2019-05-27 09:17:21 +0300 |
---|---|---|
committer | Greentime Hu <greentime@andestech.com> | 2019-05-31 10:23:25 +0300 |
commit | 8183db10db6377ac58ad048a4c827425a614695c (patch) | |
tree | 254cbc061694aca21fcd6885ced86adb8015189e /include/math-emu/op-2.h | |
parent | a188339ca5a396acc588e5851ed7e19f66b0ebd9 (diff) | |
download | linux-8183db10db6377ac58ad048a4c827425a614695c.tar.xz |
math-emu: Use statement expressions to fix Wshift-count-overflow warning
To avoid "shift count >= width of type" warning, using statement
expressions to implement the conditional controlling before constant shift
The modification in op-2.h is taken from the glibc
commit 'sysdeps/unix/sysv/lin ("fe0b1e854ad32")'.
Signed-off-by: Vincent Chen <vincentc@andestech.com>
Acked-by: Greentime Hu <greentime@andestech.com>
Signed-off-by: Greentime Hu <greentime@andestech.com>
Diffstat (limited to 'include/math-emu/op-2.h')
-rw-r--r-- | include/math-emu/op-2.h | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/include/math-emu/op-2.h b/include/math-emu/op-2.h index 13a374f51a22..244522b02076 100644 --- a/include/math-emu/op-2.h +++ b/include/math-emu/op-2.h @@ -567,16 +567,13 @@ */ #define _FP_FRAC_ASSEMBLE_2(r, X, rsize) \ - do { \ - if (rsize <= _FP_W_TYPE_SIZE) \ - r = X##_f0; \ - else \ - { \ - r = X##_f1; \ - r <<= _FP_W_TYPE_SIZE; \ - r += X##_f0; \ - } \ - } while (0) + (void) (((rsize) <= _FP_W_TYPE_SIZE) \ + ? ({ (r) = X##_f0; }) \ + : ({ \ + (r) = X##_f1; \ + (r) <<= _FP_W_TYPE_SIZE; \ + (r) += X##_f0; \ + })) #define _FP_FRAC_DISASSEMBLE_2(X, r, rsize) \ do { \ |