aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-05-14 16:34:04 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-05-14 16:34:04 -0400
commit81a01bd4815779ebeb5898a825bf91628b75ff47 (patch)
tree01ee2cdca6ba698915667b17cd4dc52735eece02 /lib/std
parent0986dcf1cf5b67ad2b2e606622bf9b2c22e01194 (diff)
downloadzig-81a01bd4815779ebeb5898a825bf91628b75ff47.tar.gz
zig-81a01bd4815779ebeb5898a825bf91628b75ff47.zip
fix codegen of sentinel-terminated arrays and .got alignment
we now have an exit(0) program working
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/mem.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/std/mem.zig b/lib/std/mem.zig
index 0b5a6adfd9..95d6b77e87 100644
--- a/lib/std/mem.zig
+++ b/lib/std/mem.zig
@@ -2099,7 +2099,11 @@ pub fn alignBackwardGeneric(comptime T: type, addr: T, alignment: T) T {
/// Given an address and an alignment, return true if the address is a multiple of the alignment
/// The alignment must be a power of 2 and greater than 0.
pub fn isAligned(addr: usize, alignment: usize) bool {
- return alignBackward(addr, alignment) == addr;
+ return isAlignedGeneric(u64, addr, alignment);
+}
+
+pub fn isAlignedGeneric(comptime T: type, addr: T, alignment: T) bool {
+ return alignBackwardGeneric(T, addr, alignment) == addr;
}
test "isAligned" {