RE: [PATCH] asm-generic: avoid __generic_cmpxchg_local warnings

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

 



...
> I had another look at why the cast is even needed for atomic_cmpxchg(),
> and as Matt describes the problem here is that atomic_t contains a
> signed 'int', but cmpxchg() takes an 'unsigned long' argument, and
> converting between the two leads to a 64-bit sign-extension of
> negative 32-bit atomics.

How about:
	signed_var + 0u + 0ull;

Converts 32bit signed to 64bit unsigned without sign extension.
Compiler will throw it all away if not needed.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux