| ... | ... | @@ -566,6 +566,13 @@ pub fn assertReadable(slice: []const volatile u8) void { |
| 566 | 566 | for (slice) |*byte| _ = byte.*; |
| 567 | 567 | } |
| 568 | 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 | |
| 569 | 576 | /// Equivalent to `@panic` but with a formatted message. |
| 570 | 577 | pub fn panic(comptime format: []const u8, args: anytype) noreturn { |
| 571 | 578 | @branchHint(.cold); |