[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/3] xtf: avoid shifting a negative value
On 06/05/16 15:57, Andrew Cooper wrote: > On 06/05/16 15:25, Roger Pau Monne wrote: >> Because it's undefined behaviour. >> >> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> >> --- >> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> >> --- >> include/arch/x86/processor.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/include/arch/x86/processor.h b/include/arch/x86/processor.h >> index c9f253f..841953c 100644 >> --- a/include/arch/x86/processor.h >> +++ b/include/arch/x86/processor.h >> @@ -134,7 +134,7 @@ >> /* Segment-based Error Code - supplemental constants. */ >> #define X86_EC_TABLE_MASK (3 << 1) >> #define X86_EC_SEL_SHIFT 3 >> -#define X86_EC_SEL_MASK (-1 << X86_EC_SEL_SHIFT) >> +#define X86_EC_SEL_MASK (-1U << X86_EC_SEL_SHIFT) > The resulting expression needs to be signed, to DTRT when implicitly > promoted. I presume this was clang complaining? > > Does using the constant (-9) work? Or indeed perhaps ~(1 << X86_EC_SEL_SHIFT) which (iirc) will keep the signed-ness of 1 even through bitwise inversion. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |