diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-08-29 14:10:59 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-08-29 14:10:59 -0700 |
| commit | de7270028d2b70ceea74c43be943b1b788c797a6 (patch) | |
| tree | 0d9b545a2a9d36c86b79178f797adf5ebcd40d17 /lib/std/Thread | |
| parent | 7c9a8ecc2aca7f925e59d282540ef8e2d1ae211e (diff) | |
| parent | e69973beddcd8a42dbc7ebcfb96187e5a6f61b61 (diff) | |
| download | zig-de7270028d2b70ceea74c43be943b1b788c797a6.tar.gz zig-de7270028d2b70ceea74c43be943b1b788c797a6.zip | |
Merge remote-tracking branch 'origin/master' into llvm15
Diffstat (limited to 'lib/std/Thread')
| -rw-r--r-- | lib/std/Thread/Futex.zig | 4 | ||||
| -rw-r--r-- | lib/std/Thread/Mutex.zig | 2 | ||||
| -rw-r--r-- | lib/std/Thread/RwLock.zig | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig index 0d9ccc8969..58f49c483e 100644 --- a/lib/std/Thread/Futex.zig +++ b/lib/std/Thread/Futex.zig @@ -703,7 +703,7 @@ const PosixImpl = struct { const max_multiplier_bits = @bitSizeOf(usize); const fibonacci_multiplier = 0x9E3779B97F4A7C15 >> (64 - max_multiplier_bits); - const max_bucket_bits = @ctz(usize, buckets.len); + const max_bucket_bits = @ctz(buckets.len); comptime assert(std.math.isPowerOfTwo(buckets.len)); const index = (address *% fibonacci_multiplier) >> (max_multiplier_bits - max_bucket_bits); @@ -721,7 +721,7 @@ const PosixImpl = struct { // then cut off the zero bits from the alignment to get the unique address. const addr = @ptrToInt(ptr); assert(addr & (alignment - 1) == 0); - return addr >> @ctz(usize, alignment); + return addr >> @ctz(alignment); } }; diff --git a/lib/std/Thread/Mutex.zig b/lib/std/Thread/Mutex.zig index 35d754ad19..973a312665 100644 --- a/lib/std/Thread/Mutex.zig +++ b/lib/std/Thread/Mutex.zig @@ -140,7 +140,7 @@ const FutexImpl = struct { // - they both seem to mark the cache-line as modified regardless: https://stackoverflow.com/a/63350048 // - `lock bts` is smaller instruction-wise which makes it better for inlining if (comptime builtin.target.cpu.arch.isX86()) { - const locked_bit = @ctz(u32, @as(u32, locked)); + const locked_bit = @ctz(@as(u32, locked)); return self.state.bitSet(locked_bit, .Acquire) == 0; } diff --git a/lib/std/Thread/RwLock.zig b/lib/std/Thread/RwLock.zig index 201e1cc860..46d46cdfa4 100644 --- a/lib/std/Thread/RwLock.zig +++ b/lib/std/Thread/RwLock.zig @@ -168,8 +168,8 @@ pub const DefaultRwLock = struct { const IS_WRITING: usize = 1; const WRITER: usize = 1 << 1; const READER: usize = 1 << (1 + @bitSizeOf(Count)); - const WRITER_MASK: usize = std.math.maxInt(Count) << @ctz(usize, WRITER); - const READER_MASK: usize = std.math.maxInt(Count) << @ctz(usize, READER); + const WRITER_MASK: usize = std.math.maxInt(Count) << @ctz(WRITER); + const READER_MASK: usize = std.math.maxInt(Count) << @ctz(READER); const Count = std.meta.Int(.unsigned, @divFloor(@bitSizeOf(usize) - 1, 2)); pub fn tryLock(rwl: *DefaultRwLock) bool { |
