Skip to content

Commit

Permalink
[libc] workaround gcc bitfield assignment warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Yifan Zhu committed Jun 14, 2024
1 parent aa8fe4e commit a6e874a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libc/src/__support/threads/linux/rwlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,9 @@ class RwLock {
public:
LIBC_INLINE constexpr RwLock(Role preference = Role::Reader,
bool is_pshared = false)
: is_pshared(is_pshared), preference(static_cast<unsigned>(preference)),
state(0), writer_tid(0), queue() {}
: is_pshared(is_pshared),
preference(static_cast<unsigned>(preference) & 1u), state(0),
writer_tid(0), queue() {}

[[nodiscard]]
LIBC_INLINE LockResult try_read_lock() {
Expand Down

0 comments on commit a6e874a

Please sign in to comment.