Rename AlignedRef -> UnalignedRef

This commit is contained in:
Christoffer Lerno
2025-07-22 15:55:43 +02:00
parent 38bc11b7b8
commit 5f0a7dd63e
2 changed files with 9 additions and 9 deletions

View File

@@ -933,14 +933,14 @@ fn void* trealloc(void* ptr, usz size, usz alignment = mem::DEFAULT_MEM_ALIGNMEN
<* <*
Takes the address of a possibly unaligned variable or member, Takes the address of a possibly unaligned variable or member,
and offers safe access to that member, by constructing an AlignedRef. and offers safe access to that member, by constructing an UnalignedRef.
@require $defined(&#arg) : "It must be possible to take the address of the argument." @require $defined(&#arg) : "It must be possible to take the address of the argument."
@return "An 'AlignedRef' with the proper type and alignment, with a pointer to argument" @return "An 'UnalignedRef' with the proper type and alignment, with a pointer to argument"
*> *>
macro @aligned_addr(#arg) @builtin macro @unaligned_addr(#arg) @builtin
{ {
return (AlignedRef{$typeof(#arg), $alignof(#arg)})&#arg; return (UnalignedRef{$typeof(#arg), $alignof(#arg)})&#arg;
} }
module std::core::mem @if(env::NO_LIBC); module std::core::mem @if(env::NO_LIBC);
@@ -1003,16 +1003,16 @@ module std::core::mem::alignment { Type, ALIGNMENT };
import std::core::mem @public; import std::core::mem @public;
<* <*
An AlignedRef offers correctly aligned access to addresses that may be unaligned or overaligned. An UnalignedRef offers correctly aligned access to addresses that may be unaligned or overaligned.
*> *>
typedef AlignedRef = Type*; typedef UnalignedRef = Type*;
macro Type AlignedRef.get(self) macro Type UnalignedRef.get(self)
{ {
return @unaligned_load(*(Type*)self, ALIGNMENT); return @unaligned_load(*(Type*)self, ALIGNMENT);
} }
macro Type AlignedRef.set(&self, Type val) macro Type UnalignedRef.set(&self, Type val)
{ {
return @unaligned_store(*(Type*)self, val, ALIGNMENT); return @unaligned_store(*(Type*)self, val, ALIGNMENT);
} }

View File

@@ -86,7 +86,7 @@
- Added readline_to_stream that takes a stream. - Added readline_to_stream that takes a stream.
- Added `Ref` and `RefCounted` experimental functionality. - Added `Ref` and `RefCounted` experimental functionality.
- Added `Volatile` generic type. - Added `Volatile` generic type.
- Added `AlignedRef` generic type. - Added `UnalignedRef` generic type.
## 0.7.3 Change list ## 0.7.3 Change list