Skip to content

Commit a6e874a

Browse files
author
Yifan Zhu
committed
[libc] workaround gcc bitfield assignment warning
1 parent aa8fe4e commit a6e874a

File tree

1 file changed

+3
-2
lines changed
  • libc/src/__support/threads/linux

1 file changed

+3
-2
lines changed

libc/src/__support/threads/linux/rwlock.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,9 @@ class RwLock {
370370
public:
371371
LIBC_INLINE constexpr RwLock(Role preference = Role::Reader,
372372
bool is_pshared = false)
373-
: is_pshared(is_pshared), preference(static_cast<unsigned>(preference)),
374-
state(0), writer_tid(0), queue() {}
373+
: is_pshared(is_pshared),
374+
preference(static_cast<unsigned>(preference) & 1u), state(0),
375+
writer_tid(0), queue() {}
375376

376377
[[nodiscard]]
377378
LIBC_INLINE LockResult try_read_lock() {

0 commit comments

Comments
 (0)