mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.atomic: make cache_line const a comptime_int
This fixes potential issues and unintended coercions in other areas, such as std.ArrayList.
This commit is contained in:
parent
339b628d4c
commit
d31bda13cb
1 changed files with 1 additions and 1 deletions
|
|
@ -482,7 +482,7 @@ pub fn cacheLineForCpu(cpu: std.Target.Cpu) u16 {
|
||||||
///
|
///
|
||||||
/// https://en.wikipedia.org/wiki/False_sharing
|
/// https://en.wikipedia.org/wiki/False_sharing
|
||||||
/// https://github.com/golang/go/search?q=CacheLinePadSize
|
/// https://github.com/golang/go/search?q=CacheLinePadSize
|
||||||
pub const cache_line = cacheLineForCpu(builtin.cpu);
|
pub const cache_line: comptime_int = cacheLineForCpu(builtin.cpu);
|
||||||
|
|
||||||
test "current CPU has a cache line size" {
|
test "current CPU has a cache line size" {
|
||||||
_ = cache_line;
|
_ = cache_line;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue