target-mips: Fix compiler warnings caused by very large constants
PATCH 1/1 target-mips: Fix compiler warnings caused by very large constants
Those constants are larger than 32 bits and need a suffix to avoid warnings from some versions of gcc.
--- target-mips/dsp_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target-mips/dsp_helper.c +2 -2
@@ -3553,7 +3553,7 @@ target_ulong helper_dextr_rs_w(target_ulong ac, target_ulong shift,if (temp128 ==0 ) { temp[0 ] =0x0FFFFFFFF ; }else { - temp[0 ] =0x0100000000 ; + temp[0 ] =0x0100000000ULL ; }set_DSPControl_overflow_flag (1 ,23 , env); }
@@ -3653,7 +3653,7 @@ target_ulong helper_extr_s_h(target_ulong ac, target_ulong shift,if (temp > (int64_t )0x7FFF ) { temp =0x00007FFF ;set_DSPControl_overflow_flag (1 ,23 , env); - }else if (temp < (int64_t )0xFFFFFFFFFFFF8000 ) { + }else if (temp < (int64_t )0xFFFFFFFFFFFF8000LL ) { temp =0xFFFF8000 ;set_DSPControl_overflow_flag (1 ,23 , env); }
Signature · 1 line
1.7.10.4
Quoted 22 lines · Stefan Weil
Those constants are larger than 32 bits and need a suffix to avoid warnings from some versions of gcc.
Signed-off-by Stefan Weil <[email protected]>--- target-mips/dsp_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target-mips/dsp_helper.c +1
-1@@ -3553,7 +3553,7 @@ target_ulong helper_dextr_rs_w(target_ulong ac, target_ulong shift,if (temp128 ==0 ) { temp[0 ] =0x0FFFFFFFF ; }else { - temp[0 ] =0x0100000000 ; + temp[0 ] =0x0100000000ULL ; }set_DSPControl_overflow_flag (1 ,23 , env); }
target-mips/dsp_helper.c target_ulong helper_extr_s_h(target_ulong ac, target_ulong shift, · line 3659
Quoted 8 lines
target-mips/dsp_helper.c +1
-1@@ -3653,7 +3653,7 @@ target_ulong helper_extr_s_h(target_ulong ac, target_ulong shift,if (temp > (int64_t )0x7FFF ) { temp =0x00007FFF ;set_DSPControl_overflow_flag (1 ,23 , env); - }else if (temp < (int64_t )0xFFFFFFFFFFFF8000 ) { + }else if (temp < (int64_t )0xFFFFFFFFFFFF8000LL ) { temp =0xFFFF8000 ;set_DSPControl_overflow_flag (1 ,23 , env); }
Blue Swirl proposed the same patch a bit earlier then you, and I have just applied it.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 4 lines · Aurelien Jarno
Quoted 3 lines · Stefan Weil
Those constants are larger than 32 bits and need a suffix to avoid warnings from some versions of gcc.
Quoted 8 lines
target-mips/dsp_helper.c target_ulong helper_extr_s_h(target_ulong ac, target_ulong shift, · line 3656
Quoted 8 lines
Signed-off-by Stefan Weil <[email protected]>target-mips/dsp_helper.c +1
-1@@ -3653,7 +3653,7 @@ target_ulong helper_extr_s_h(target_ulong ac, target_ulong shift,if (temp > (int64_t )0x7FFF ) { temp =0x00007FFF ;set_DSPControl_overflow_flag (1 ,23 , env); - }else if (temp < (int64_t )0xFFFFFFFFFFFF8000 ) { + }else if (temp < (int64_t )0xFFFFFFFFFFFF8000LL ) {
Instead of using both a suffix and a cast to int64_t, shouldn't we instead be writing '(temp < INT64_C(0xFFFFFFFFFFFF8000))'?
Quoted 3 lines
Blue Swirl proposed the same patch a bit earlier then you, and I have just applied it.
But since I've seldom seen code using the *_C() macros from <stdint.h>, it doesn't bother me enough to pursue it any further now that the immediate concern of compiler warnings has been silenced.
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org