[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [Qemu-devel] [PATCH v5 09/36] ppc/xive: notify the CPU wh

From: Eric Blake
Subject: Re: [Qemu-ppc] [Qemu-devel] [PATCH v5 09/36] ppc/xive: notify the CPU when the interrupt priority is more privileged
Date: Tue, 27 Nov 2018 21:00:17 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

On 11/27/18 8:41 PM, David Gibson wrote:
On Wed, Nov 28, 2018 at 01:32:21PM +1100, Benjamin Herrenschmidt wrote:
On Wed, 2018-11-28 at 11:13 +1100, David Gibson wrote:
Don't you need a cast to avoid (nsr << 8) being a shift-wider-than-size?

Shouldn't be a problem as long as it fits in an int, no ?

I dunno, I can never remember the rules about when C extends and when
it doesn't.  I'm not sure anybody does, which is kind of the point.

As soon as you perform arithmetic on a type narrower than int, it is first promoted to at least int (possibly wider, depending on the type of the other operand to the binary operator). And, since C guarantees that int is larger than 8 bits, 'uint8_t << 8' and 'int8_t << 8' are both well-defined, without needing a cast of nsr.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]