[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCHv4 1/5] x86: provide add_sized()
On 13/05/15 10:23, Jan Beulich wrote: >>>> On 11.05.15 at 16:37, <david.vrabel@xxxxxxxxxx> wrote: >> @@ -53,6 +67,19 @@ void __bad_atomic_size(void); >> } \ >> }) >> >> +#define add_sized(p, x) ({ \ >> + typeof(*(p)) __x = (x); \ >> + unsigned long x_ = (unsigned long)__x; \ > > So is there a particular reason you kept this double type conversion? > As said earlier, I can see why write_atomic() wants it, but I don't see > the need here. I kept it in case typeof (*p) wasn't a numeric type (like a struct { u32 a; }) and needed the cast to unsigned long, although in hindsight I'm not sure this really makes any sense. David >> + switch ( sizeof(*(p)) ) \ >> + { \ >> + case 1: add_u8_sized((uint8_t *)(p), x_); break; \ >> + case 2: add_u16_sized((uint16_t *)(p), x_); break; \ >> + case 4: add_u32_sized((uint32_t *)(p), x_); break; \ >> + case 8: add_u64_sized((uint64_t *)(p), x_); break; \ >> + default: __bad_atomic_size(); break; \ >> + } \ >> +}) > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |