mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.mem.alignForwardGeneric: manually inline the assertions
This matches more directly the documentation comments, and makes it more obvious what went wrong when an assertion fails.
This commit is contained in:
parent
41cdcd5486
commit
75cf06c187
1 changed files with 2 additions and 1 deletions
|
|
@ -4226,7 +4226,8 @@ pub fn alignForwardLog2(addr: usize, log2_alignment: u8) usize {
|
|||
/// The alignment must be a power of 2 and greater than 0.
|
||||
/// Asserts that rounding up the address does not cause integer overflow.
|
||||
pub fn alignForwardGeneric(comptime T: type, addr: T, alignment: T) T {
|
||||
assert(isValidAlignGeneric(T, alignment));
|
||||
assert(alignment > 0);
|
||||
assert(std.math.isPowerOfTwo(alignment));
|
||||
return alignBackwardGeneric(T, addr + (alignment - 1), alignment);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue