Displaying 3 results from an estimated 3 matches for "ncsw".
Did you mean:
csw
2018 Sep 17
1
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
...FreeBSD version:
>
> #define IS_ALIGNED <http://fxr.watson.org/fxr/ident?i=IS_ALIGNED>(n
> <http://fxr.watson.org/fxr/ident?i=n>,align) (!((uint32_t)(n
> <http://fxr.watson.org/fxr/ident?i=n>) & (align - 1)))
>
> http://fxr.watson.org/fxr/source/contrib/ncsw/inc/ncsw_ext.h#L182
Which truncates to 32 bits. But that's what we're trying to get rid of
- by moving to a macro that lets us do full 64-bit alignment if needed.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
2018 Sep 17
2
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On 9/17/18 3:39 PM, Nir Soffer wrote:
>> +#define IS_ALIGNED(size, align) ({ \
>> + assert (is_power_of_2 ((align))); \
>> + !((size) & ((align) - 1)); \
>> +})
>>
>
> But this version will happily accept singed int, and I think this code
> behavior with signed int is undefined.
Well, sort of. Bit shifts
2018 Sep 17
0
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
...issively licensed).
>
The FreeBSD version:
#define IS_ALIGNED <http://fxr.watson.org/fxr/ident?i=IS_ALIGNED>(n
<http://fxr.watson.org/fxr/ident?i=n>,align) (!((uint32_t)(n
<http://fxr.watson.org/fxr/ident?i=n>) & (align - 1)))
http://fxr.watson.org/fxr/source/contrib/ncsw/inc/ncsw_ext.h#L182
Nir