mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.debug.assertAligned: support const pointers
This commit is contained in:
parent
cbe1b4571b
commit
f06c3d8be7
@ -569,7 +569,7 @@ pub fn assertReadable(slice: []const volatile u8) void {
|
|||||||
/// Invokes detectable illegal behavior when the provided array is not aligned
|
/// Invokes detectable illegal behavior when the provided array is not aligned
|
||||||
/// to the provided amount.
|
/// to the provided amount.
|
||||||
pub fn assertAligned(ptr: anytype, comptime alignment: std.mem.Alignment) void {
|
pub fn assertAligned(ptr: anytype, comptime alignment: std.mem.Alignment) void {
|
||||||
const aligned_ptr: *align(alignment.toByteUnits()) anyopaque = @ptrCast(@alignCast(ptr));
|
const aligned_ptr: *align(alignment.toByteUnits()) const anyopaque = @ptrCast(@alignCast(ptr));
|
||||||
_ = aligned_ptr;
|
_ = aligned_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user