From 5f0a7dd63eb6dd1eb4fd3bc96b505752efba7c8b Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 22 Jul 2025 15:55:43 +0200 Subject: [PATCH] Rename AlignedRef -> UnalignedRef --- lib/std/core/mem.c3 | 16 ++++++++-------- releasenotes.md | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/std/core/mem.c3 b/lib/std/core/mem.c3 index 37bfc04f3..588c03d3a 100644 --- a/lib/std/core/mem.c3 +++ b/lib/std/core/mem.c3 @@ -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, - 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." - @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); @@ -1003,16 +1003,16 @@ module std::core::mem::alignment { Type, ALIGNMENT }; 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); } -macro Type AlignedRef.set(&self, Type val) +macro Type UnalignedRef.set(&self, Type val) { return @unaligned_store(*(Type*)self, val, ALIGNMENT); } diff --git a/releasenotes.md b/releasenotes.md index 9e5290204..a434302b2 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -86,7 +86,7 @@ - Added readline_to_stream that takes a stream. - Added `Ref` and `RefCounted` experimental functionality. - Added `Volatile` generic type. -- Added `AlignedRef` generic type. +- Added `UnalignedRef` generic type. ## 0.7.3 Change list