[libc-commits] [PATCH] D155511: [libc] Treat the locks array as a bitfield
Jon Chesterfield via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Jul 18 03:45:14 PDT 2023
JonChesterfield added a comment.
In D155511#4509776 <https://reviews.llvm.org/D155511#4509776>, @JonChesterfield wrote:
> Sad to see this isn't a type. Part of the point of encapsulating the indexing and mutation ops is the inbox outbox array's could also be bitmaps.
>
> Even without that, there's no rea
================
Comment at: libc/src/__support/RPC/rpc.h:91
+ // We use a bitfield to store the locks.
+ static constexpr uint32_t BITFIELD_SIZE = sizeof(uint32_t) * 8;
+ cpp::Atomic<uint32_t> lock[DEFAULT_PORT_COUNT / sizeof(uint32_t)] = {0};
----------------
This isn't the size of the bitmap. I don't know what a bitfield is. Bits per word?
I'm not convinced we should pretend this stuff works for atomic types other than plain integers.
How about a static assert that atomic uint32 is the same size as a uint32 and write 32 here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155511/new/
https://reviews.llvm.org/D155511
More information about the libc-commits
mailing list