1const std = @import("std"); 2const expect = std.testing.expect; 3const builtin = @import("builtin"); 4const native_arch = builtin.target.cpu.arch; 5 6test "page aligned array on stack" { 7 // Large alignment value to make it hard to accidentally pass. 8 var array align(0x1000) = [_]u8{ 1, 2, 3, 4, 5, 6, 7, 8 }; 9 var number1: u8 align(16) = 42; 10 var number2: u8 align(16) = 43; 11 12 try expect(@ptrToInt(&array[0]) & 0xFFF == 0); 13 try expect(array[3] == 4); 14 15 try expect(@truncate(u4, @ptrToInt(&number1)) == 0); 16 try expect(@truncate(u4, @ptrToInt(&number2)) == 0); 17 try expect(number1 == 42); 18 try expect(number2 == 43); 19} 20