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

Re: [Xen-devel] [PATCHv4 1/5] x86: provide add_sized()



>>> 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.

Jan

> +    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


 


Rackspace

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