mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +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
@ -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…
x
Reference in New Issue
Block a user