Add Volatile type.

This commit is contained in:
Christoffer Lerno
2025-07-22 14:13:48 +02:00
parent 53051e04a3
commit 428165590e
3 changed files with 40 additions and 0 deletions

View File

@@ -968,3 +968,18 @@ fn void* __memcpy(void* dst, void* src, usz n) @weak @export("memcpy")
}
return dst;
}
module std::core::mem::volatile { Type };
typedef Volatile @structlike = Type;
macro Type Volatile.get(&self)
{
return @volatile_load(*(Type*)self);
}
macro Type Volatile.set(&self, Type val)
{
return @volatile_store(*(Type*)self, val);
}