We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bad836a commit 83d1f88Copy full SHA for 83d1f88
lib/std/debug.zig
@@ -566,6 +566,13 @@ pub fn assertReadable(slice: []const volatile u8) void {
566
for (slice) |*byte| _ = byte.*;
567
}
568
569
+/// Invokes detectable illegal behavior when the provided array is not aligned
570
+/// to the provided amount.
571
+pub fn assertAligned(ptr: anytype, comptime alignment: std.mem.Alignment) void {
572
+ const aligned_ptr: *align(alignment.toByteUnits()) anyopaque = @alignCast(@ptrCast(ptr));
573
+ _ = aligned_ptr;
574
+}
575
+
576
/// Equivalent to `@panic` but with a formatted message.
577
pub fn panic(comptime format: []const u8, args: anytype) noreturn {
578
@branchHint(.cold);
0 commit comments