[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 at 11:35, <david.vrabel@xxxxxxxxxx> wrote:
> 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.

Indeed - such an attempt of a conversion would result in a
compilation error. The only thing that could need this would be
pointers, but (as said before) I don't think add_sized makes
much sense for pointers (it would be actively misleading for
pointers to other than void or 1-byte types).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.