All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH for 1.6] hw/core: Fix wrong left shift (build regression)
@ 2013-07-31  5:00 ` Stefan Weil
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2013-07-31  5:00 UTC (permalink / raw)
  To: qemu-trivial; +Cc: Stefan Weil, Anthony Liguori, qemu-devel

Shifting a long int (32 bit) by 40 bit positions won't work.
Compiler message:

hw/core/qdev-properties.c: In function ‘print_size’:
hw/core/qdev-properties.c:1180:5: warning: left shift count >= width of type

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 hw/core/qdev-properties.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 8d43a8d..e82ab87 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1177,7 +1177,7 @@ static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len)
     int i = 0;
     uint64_t div;
 
-    for (div = (long int)1 << 40; !(*ptr / div) ; div >>= 10) {
+    for (div = 1ULL << 40; !(*ptr / div); div >>= 10) {
         i++;
     }
     return snprintf(dest, len, "%0.03f%c", (double)*ptr/div, suffixes[i]);
-- 
1.7.10.4



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

* [Qemu-devel] [PATCH for 1.6] hw/core: Fix wrong left shift (build regression)
@ 2013-07-31  5:00 ` Stefan Weil
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2013-07-31  5:00 UTC (permalink / raw)
  To: qemu-trivial; +Cc: Stefan Weil, Anthony Liguori, qemu-devel

Shifting a long int (32 bit) by 40 bit positions won't work.
Compiler message:

hw/core/qdev-properties.c: In function ‘print_size’:
hw/core/qdev-properties.c:1180:5: warning: left shift count >= width of type

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 hw/core/qdev-properties.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 8d43a8d..e82ab87 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1177,7 +1177,7 @@ static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len)
     int i = 0;
     uint64_t div;
 
-    for (div = (long int)1 << 40; !(*ptr / div) ; div >>= 10) {
+    for (div = 1ULL << 40; !(*ptr / div); div >>= 10) {
         i++;
     }
     return snprintf(dest, len, "%0.03f%c", (double)*ptr/div, suffixes[i]);
-- 
1.7.10.4

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

* Re: [Qemu-trivial] [Qemu-devel] [PATCH for 1.6] hw/core: Fix wrong left shift (build regression)
  2013-07-31  5:00 ` [Qemu-devel] " Stefan Weil
@ 2013-07-31  7:41   ` Andreas Färber
  -1 siblings, 0 replies; 4+ messages in thread
From: Andreas Färber @ 2013-07-31  7:41 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Anthony Liguori, qemu-devel

Am 31.07.2013 07:00, schrieb Stefan Weil:
> Shifting a long int (32 bit) by 40 bit positions won't work.
> Compiler message:
> 
> hw/core/qdev-properties.c: In function ‘print_size’:
> hw/core/qdev-properties.c:1180:5: warning: left shift count >= width of type
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  hw/core/qdev-properties.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Compare rth's patch:
http://patchwork.ozlabs.org/patch/263513/

Andreas

> 
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 8d43a8d..e82ab87 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -1177,7 +1177,7 @@ static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len)
>      int i = 0;
>      uint64_t div;
>  
> -    for (div = (long int)1 << 40; !(*ptr / div) ; div >>= 10) {
> +    for (div = 1ULL << 40; !(*ptr / div); div >>= 10) {
>          i++;
>      }
>      return snprintf(dest, len, "%0.03f%c", (double)*ptr/div, suffixes[i]);
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg


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

* Re: [Qemu-devel] [PATCH for 1.6] hw/core: Fix wrong left shift (build regression)
@ 2013-07-31  7:41   ` Andreas Färber
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Färber @ 2013-07-31  7:41 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Anthony Liguori, qemu-devel

Am 31.07.2013 07:00, schrieb Stefan Weil:
> Shifting a long int (32 bit) by 40 bit positions won't work.
> Compiler message:
> 
> hw/core/qdev-properties.c: In function ‘print_size’:
> hw/core/qdev-properties.c:1180:5: warning: left shift count >= width of type
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  hw/core/qdev-properties.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Compare rth's patch:
http://patchwork.ozlabs.org/patch/263513/

Andreas

> 
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 8d43a8d..e82ab87 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -1177,7 +1177,7 @@ static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len)
>      int i = 0;
>      uint64_t div;
>  
> -    for (div = (long int)1 << 40; !(*ptr / div) ; div >>= 10) {
> +    for (div = 1ULL << 40; !(*ptr / div); div >>= 10) {
>          i++;
>      }
>      return snprintf(dest, len, "%0.03f%c", (double)*ptr/div, suffixes[i]);
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

end of thread, other threads:[~2013-07-31  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31  5:00 [Qemu-trivial] [PATCH for 1.6] hw/core: Fix wrong left shift (build regression) Stefan Weil
2013-07-31  5:00 ` [Qemu-devel] " Stefan Weil
2013-07-31  7:41 ` [Qemu-trivial] " Andreas Färber
2013-07-31  7:41   ` Andreas Färber

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.