[PATCH 1/6] eal: add bitset type
Mattias Rönnblom
hofors at lysator.liu.se
Mon Sep 2 16:46:58 CEST 2024
On 2024-09-02 15:55, Morten Brørup wrote:
>> From: Mattias Rönnblom [mailto:mattias.ronnblom at ericsson.com]
>> Sent: Friday, 9 August 2024 22.15
>>
>> Introduce a set of functions and macros that operate on sets of bits,
>> kept in arrays of 64-bit words.
>
> This could be 32-bit words on 32 bit architectures. Just an idea.
>
The use of "unsigned long" instead of "uint64_t" as the type has been
discussed before on the list.
I prefer uint64_t because it's less to type and the performance benefits
of using "unsigned long" on 32-bit ISAs likely are small. That said, I
have no strong opinion on the subject.
>>
>> RTE bitset is designed for bitsets which are larger than what fits in
>> a single machine word (i.e., 64 bits). For very large bitsets, the
>> <rte_bitmap.h> API may be a more appropriate choice.
>
> RTE bitset uses size_t to index the bits.
> This means that it supports very large bitsets.
>
Yes, it does, although I can't say I see a use case for enormous
bitsets. But, who knows.
I used size_t in an attempt to slightly improve readability.
Performance wise, it does not matter, at least in the tests I did. I
don't know if it ever could, considering these functions will pretty
much always be inlined.
> If it is not supposed to support more than 2^32 bits, it could use uint32_t for indexing.
> I don't know if it make any practical difference.
>
>>
>> Depends-on: series-32740 ("Improve EAL bit operations API")
>>
>> Signed-off-by: Mattias Rönnblom <mattias.ronnblom at ericsson.com>
>>
>> --
>
> With or without considering the above ideas, this library is a good addition to DPDK.
>
> For the series,
> Acked-by: Morten Brørup <mb at smartsharesystems.com>
>
More information about the dev
mailing list