qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-mips: Fix compiler warnings caused by very large constants
@ 2012-11-04 20:29 Stefan Weil
  2012-11-05  7:03 ` Aurelien Jarno
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Weil @ 2012-11-04 20:29 UTC (permalink / raw)
  To: qemu-trivial; +Cc: Stefan Weil, qemu-devel, Aurelien Jarno

Those constants are larger than 32 bits and need a suffix to avoid
warnings from some versions of gcc.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 target-mips/dsp_helper.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
index b59133e..2ab9956 100644
--- a/target-mips/dsp_helper.c
+++ b/target-mips/dsp_helper.c
@@ -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);
     }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target-mips: Fix compiler warnings caused by very large constants
  2012-11-04 20:29 [Qemu-devel] [PATCH] target-mips: Fix compiler warnings caused by very large constants Stefan Weil
@ 2012-11-05  7:03 ` Aurelien Jarno
  2012-11-05 18:41   ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Aurelien Jarno @ 2012-11-05  7:03 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, qemu-devel

On Sun, Nov 04, 2012 at 09:29:35PM +0100, Stefan Weil wrote:
> Those constants are larger than 32 bits and need a suffix to avoid
> warnings from some versions of gcc.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  target-mips/dsp_helper.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
> index b59133e..2ab9956 100644
> --- a/target-mips/dsp_helper.c
> +++ b/target-mips/dsp_helper.c
> @@ -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);
>      }

Blue Swirl proposed the same patch a bit earlier then you, and I have
just applied it.


-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target-mips: Fix compiler warnings caused by very large constants
  2012-11-05  7:03 ` Aurelien Jarno
@ 2012-11-05 18:41   ` Eric Blake
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Blake @ 2012-11-05 18:41 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: qemu-trivial, Stefan Weil, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]

On 11/05/2012 12:03 AM, Aurelien Jarno wrote:
> On Sun, Nov 04, 2012 at 09:29:35PM +0100, Stefan Weil wrote:
>> Those constants are larger than 32 bits and need a suffix to avoid
>> warnings from some versions of gcc.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>

>> @@ -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))'?

> 
> 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.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 617 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-05 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-04 20:29 [Qemu-devel] [PATCH] target-mips: Fix compiler warnings caused by very large constants Stefan Weil
2012-11-05  7:03 ` Aurelien Jarno
2012-11-05 18:41   ` Eric Blake

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).