mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
ec95e00e28
stage2: change logic for detecting whether the main package is inside the std package. Previously it relied on realpath() which is not portable. This uses resolve() which is how imports already work. * stage2: fix cleanup bug when creating Module * flatten lib/std/special/* to lib/* - this was motivated by making main_pkg_is_inside_std false for compiler_rt & friends. * rename "mini libc" to "universal libc"
22 lines
846 B
Zig
22 lines
846 B
Zig
const __divti3 = @import("divti3.zig").__divti3;
|
|
const testing = @import("std").testing;
|
|
|
|
fn test__divti3(a: i128, b: i128, expected: i128) !void {
|
|
const x = __divti3(a, b);
|
|
try testing.expect(x == expected);
|
|
}
|
|
|
|
test "divti3" {
|
|
try test__divti3(0, 1, 0);
|
|
try test__divti3(0, -1, 0);
|
|
try test__divti3(2, 1, 2);
|
|
try test__divti3(2, -1, -2);
|
|
try test__divti3(-2, 1, -2);
|
|
try test__divti3(-2, -1, 2);
|
|
|
|
try test__divti3(@bitCast(i128, @as(u128, 0x8 << 124)), 1, @bitCast(i128, @as(u128, 0x8 << 124)));
|
|
try test__divti3(@bitCast(i128, @as(u128, 0x8 << 124)), -1, @bitCast(i128, @as(u128, 0x8 << 124)));
|
|
try test__divti3(@bitCast(i128, @as(u128, 0x8 << 124)), -2, @bitCast(i128, @as(u128, 0x4 << 124)));
|
|
try test__divti3(@bitCast(i128, @as(u128, 0x8 << 124)), 2, @bitCast(i128, @as(u128, 0xc << 124)));
|
|
}
|