move std/debug.zig to a subdirectory
self hosted compiler parser tests do some fuzz testingmaster
parent
9dae796fe3
commit
4183c6f1a5
|
@ -516,7 +516,8 @@ install(FILES "${CMAKE_SOURCE_DIR}/std/c/index.zig" DESTINATION "${ZIG_STD_DEST}
|
|||
install(FILES "${CMAKE_SOURCE_DIR}/std/c/linux.zig" DESTINATION "${ZIG_STD_DEST}/c")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/std/c/windows.zig" DESTINATION "${ZIG_STD_DEST}/c")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/std/cstr.zig" DESTINATION "${ZIG_STD_DEST}")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/std/debug.zig" DESTINATION "${ZIG_STD_DEST}")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/std/debug/index.zig" DESTINATION "${ZIG_STD_DEST}/debug")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/std/debug/failing_allocator.zig" DESTINATION "${ZIG_STD_DEST}/debug")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/std/dwarf.zig" DESTINATION "${ZIG_STD_DEST}")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/std/elf.zig" DESTINATION "${ZIG_STD_DEST}")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/std/empty.zig" DESTINATION "${ZIG_STD_DEST}")
|
||||
|
|
|
@ -172,7 +172,8 @@ pub fn installStdLib(b: &Builder) {
|
|||
"c/linux.zig",
|
||||
"c/windows.zig",
|
||||
"cstr.zig",
|
||||
"debug.zig",
|
||||
"debug/failing_allocator.zig",
|
||||
"debug/index.zig",
|
||||
"dwarf.zig",
|
||||
"elf.zig",
|
||||
"empty.zig",
|
||||
|
|
|
@ -1119,18 +1119,24 @@ fn testCanonical(source: []const u8) {
|
|||
break :x failing_allocator.index;
|
||||
};
|
||||
|
||||
// TODO make this pass
|
||||
//var fail_index = needed_alloc_count;
|
||||
//while (fail_index != 0) {
|
||||
// fail_index -= 1;
|
||||
// var fixed_allocator = mem.FixedBufferAllocator.init(fixed_buffer_mem[0..]);
|
||||
// var failing_allocator = std.debug.FailingAllocator.init(&fixed_allocator.allocator, fail_index);
|
||||
// if (testParse(source, &failing_allocator.allocator)) |_| {
|
||||
// @panic("non-deterministic memory usage");
|
||||
// } else |err| {
|
||||
// assert(err == error.OutOfMemory);
|
||||
// }
|
||||
//}
|
||||
var fail_index: usize = 0;
|
||||
while (fail_index < needed_alloc_count) : (fail_index += 1) {
|
||||
var fixed_allocator = mem.FixedBufferAllocator.init(fixed_buffer_mem[0..]);
|
||||
var failing_allocator = std.debug.FailingAllocator.init(&fixed_allocator.allocator, fail_index);
|
||||
if (testParse(source, &failing_allocator.allocator)) |_| {
|
||||
@panic("non-deterministic memory usage");
|
||||
} else |err| {
|
||||
assert(err == error.OutOfMemory);
|
||||
// TODO make this pass
|
||||
//if (failing_allocator.allocated_bytes != failing_allocator.freed_bytes) {
|
||||
// warn("\nfail_index: {}/{}\nallocated bytes: {}\nfreed bytes: {}\nallocations: {}\ndeallocations: {}\n",
|
||||
// fail_index, needed_alloc_count,
|
||||
// failing_allocator.allocated_bytes, failing_allocator.freed_bytes,
|
||||
// failing_allocator.index, failing_allocator.deallocations);
|
||||
// @panic("memory leak detected");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test "zig fmt" {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const debug = @import("debug.zig");
|
||||
const std = @import("index.zig");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const mem = @import("mem.zig");
|
||||
const mem = std.mem;
|
||||
const Allocator = mem.Allocator;
|
||||
|
||||
pub fn ArrayList(comptime T: type) -> type {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const assert = @import("debug.zig").assert;
|
||||
const mem = @import("mem.zig");
|
||||
const std = @import("index.zig");
|
||||
const assert = std.debug.assert;
|
||||
const mem = std.mem;
|
||||
|
||||
pub const standard_alphabet_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
pub const standard_pad_char = '=';
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
const debug = @import("debug.zig");
|
||||
const mem = @import("mem.zig");
|
||||
const std = @import("index.zig");
|
||||
const debug = std.debug;
|
||||
const mem = std.mem;
|
||||
const Allocator = mem.Allocator;
|
||||
const assert = debug.assert;
|
||||
const ArrayList = @import("array_list.zig").ArrayList;
|
||||
const ArrayList = std.ArrayList;
|
||||
|
||||
const fmt = @import("fmt/index.zig");
|
||||
const fmt = std.fmt;
|
||||
|
||||
/// A buffer that allocates memory and maintains a null byte at the end.
|
||||
pub const Buffer = struct {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const debug = @import("debug.zig");
|
||||
const mem = @import("mem.zig");
|
||||
const std = @import("index.zig");
|
||||
const debug = std.debug;
|
||||
const mem = std.mem;
|
||||
const assert = debug.assert;
|
||||
|
||||
pub fn len(ptr: &const u8) -> usize {
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
const std = @import("../index.zig");
|
||||
const mem = std.mem;
|
||||
|
||||
/// Allocator that fails after N allocations, useful for making sure out of
|
||||
/// memory conditions are handled correctly.
|
||||
pub const FailingAllocator = struct {
|
||||
allocator: mem.Allocator,
|
||||
index: usize,
|
||||
fail_index: usize,
|
||||
internal_allocator: &mem.Allocator,
|
||||
allocated_bytes: usize,
|
||||
freed_bytes: usize,
|
||||
deallocations: usize,
|
||||
|
||||
pub fn init(allocator: &mem.Allocator, fail_index: usize) -> FailingAllocator {
|
||||
return FailingAllocator {
|
||||
.internal_allocator = allocator,
|
||||
.fail_index = fail_index,
|
||||
.index = 0,
|
||||
.allocated_bytes = 0,
|
||||
.freed_bytes = 0,
|
||||
.deallocations = 0,
|
||||
.allocator = mem.Allocator {
|
||||
.allocFn = alloc,
|
||||
.reallocFn = realloc,
|
||||
.freeFn = free,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
fn alloc(allocator: &mem.Allocator, n: usize, alignment: u29) -> %[]u8 {
|
||||
const self = @fieldParentPtr(FailingAllocator, "allocator", allocator);
|
||||
if (self.index == self.fail_index) {
|
||||
return error.OutOfMemory;
|
||||
}
|
||||
const result = %return self.internal_allocator.allocFn(self.internal_allocator, n, alignment);
|
||||
self.allocated_bytes += result.len;
|
||||
self.index += 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
fn realloc(allocator: &mem.Allocator, old_mem: []u8, new_size: usize, alignment: u29) -> %[]u8 {
|
||||
const self = @fieldParentPtr(FailingAllocator, "allocator", allocator);
|
||||
if (new_size <= old_mem.len) {
|
||||
self.freed_bytes += old_mem.len - new_size;
|
||||
return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, new_size, alignment);
|
||||
}
|
||||
if (self.index == self.fail_index) {
|
||||
return error.OutOfMemory;
|
||||
}
|
||||
const result = %return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, new_size, alignment);
|
||||
self.allocated_bytes += new_size - old_mem.len;
|
||||
self.deallocations += 1;
|
||||
self.index += 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
fn free(allocator: &mem.Allocator, bytes: []u8) {
|
||||
const self = @fieldParentPtr(FailingAllocator, "allocator", allocator);
|
||||
self.freed_bytes += bytes.len;
|
||||
self.deallocations += 1;
|
||||
return self.internal_allocator.freeFn(self.internal_allocator, bytes);
|
||||
}
|
||||
};
|
|
@ -1,10 +1,10 @@
|
|||
const std = @import("index.zig");
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const mem = std.mem;
|
||||
const io = std.io;
|
||||
const os = std.os;
|
||||
const elf = @import("elf.zig");
|
||||
const DW = @import("dwarf.zig");
|
||||
const elf = std.elf;
|
||||
const DW = std.dwarf;
|
||||
const ArrayList = std.ArrayList;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
|
@ -992,59 +992,3 @@ fn readILeb128(in_stream: &io.InStream) -> %i64 {
|
|||
pub const global_allocator = &global_fixed_allocator.allocator;
|
||||
var global_fixed_allocator = mem.FixedBufferAllocator.init(global_allocator_mem[0..]);
|
||||
var global_allocator_mem: [100 * 1024]u8 = undefined;
|
||||
|
||||
/// Allocator that fails after N allocations, useful for making sure out of
|
||||
/// memory conditions are handled correctly.
|
||||
pub const FailingAllocator = struct {
|
||||
allocator: mem.Allocator,
|
||||
index: usize,
|
||||
fail_index: usize,
|
||||
internal_allocator: &mem.Allocator,
|
||||
allocated_bytes: usize,
|
||||
|
||||
pub fn init(allocator: &mem.Allocator, fail_index: usize) -> FailingAllocator {
|
||||
return FailingAllocator {
|
||||
.internal_allocator = allocator,
|
||||
.fail_index = fail_index,
|
||||
.index = 0,
|
||||
.allocated_bytes = 0,
|
||||
.allocator = mem.Allocator {
|
||||
.allocFn = alloc,
|
||||
.reallocFn = realloc,
|
||||
.freeFn = free,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
fn alloc(allocator: &mem.Allocator, n: usize, alignment: u29) -> %[]u8 {
|
||||
const self = @fieldParentPtr(FailingAllocator, "allocator", allocator);
|
||||
if (self.index == self.fail_index) {
|
||||
return error.OutOfMemory;
|
||||
}
|
||||
self.index += 1;
|
||||
const result = %return self.internal_allocator.allocFn(self.internal_allocator, n, alignment);
|
||||
self.allocated_bytes += result.len;
|
||||
return result;
|
||||
}
|
||||
|
||||
fn realloc(allocator: &mem.Allocator, old_mem: []u8, new_size: usize, alignment: u29) -> %[]u8 {
|
||||
const self = @fieldParentPtr(FailingAllocator, "allocator", allocator);
|
||||
if (new_size <= old_mem.len) {
|
||||
self.allocated_bytes -= old_mem.len - new_size;
|
||||
return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, new_size, alignment);
|
||||
}
|
||||
if (self.index == self.fail_index) {
|
||||
return error.OutOfMemory;
|
||||
}
|
||||
self.index += 1;
|
||||
const result = %return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, new_size, alignment);
|
||||
self.allocated_bytes += new_size - old_mem.len;
|
||||
return result;
|
||||
}
|
||||
|
||||
fn free(allocator: &mem.Allocator, bytes: []u8) {
|
||||
const self = @fieldParentPtr(FailingAllocator, "allocator", allocator);
|
||||
self.allocated_bytes -= bytes.len;
|
||||
return self.internal_allocator.freeFn(self.internal_allocator, bytes);
|
||||
}
|
||||
};
|
|
@ -1,10 +1,11 @@
|
|||
const std = @import("../../index.zig");
|
||||
const enum3 = @import("enum3.zig").enum3;
|
||||
const enum3_data = @import("enum3.zig").enum3_data;
|
||||
const lookup_table = @import("lookup.zig").lookup_table;
|
||||
const HP = @import("lookup.zig").HP;
|
||||
const math = @import("../../math/index.zig");
|
||||
const mem = @import("../../mem.zig");
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const math = std.math;
|
||||
const mem = std.mem;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub const FloatDecimal = struct {
|
||||
digits: []u8,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const math = @import("../math/index.zig");
|
||||
const debug = @import("../debug.zig");
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const mem = @import("../mem.zig");
|
||||
const mem = std.mem;
|
||||
const builtin = @import("builtin");
|
||||
const errol3 = @import("errol/index.zig").errol3;
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const debug = @import("debug.zig");
|
||||
const std = @import("index.zig");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const math = @import("math/index.zig");
|
||||
const mem = @import("mem.zig");
|
||||
const math = std.math;
|
||||
const mem = std.mem;
|
||||
const Allocator = mem.Allocator;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
const debug = @import("debug.zig");
|
||||
const std = @import("index.zig");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const mem = @import("mem.zig");
|
||||
const os = @import("os/index.zig");
|
||||
const mem = std.mem;
|
||||
const os = std.os;
|
||||
const builtin = @import("builtin");
|
||||
const Os = builtin.Os;
|
||||
const c = @import("c/index.zig");
|
||||
const c = std.c;
|
||||
|
||||
const Allocator = mem.Allocator;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ pub const base64 = @import("base64.zig");
|
|||
pub const build = @import("build.zig");
|
||||
pub const c = @import("c/index.zig");
|
||||
pub const cstr = @import("cstr.zig");
|
||||
pub const debug = @import("debug.zig");
|
||||
pub const debug = @import("debug/index.zig");
|
||||
pub const dwarf = @import("dwarf.zig");
|
||||
pub const elf = @import("elf.zig");
|
||||
pub const empty_import = @import("empty.zig");
|
||||
|
@ -39,7 +39,7 @@ test "std" {
|
|||
_ = @import("build.zig");
|
||||
_ = @import("c/index.zig");
|
||||
_ = @import("cstr.zig");
|
||||
_ = @import("debug.zig");
|
||||
_ = @import("debug/index.zig");
|
||||
_ = @import("dwarf.zig");
|
||||
_ = @import("elf.zig");
|
||||
_ = @import("empty.zig");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const debug = @import("debug.zig");
|
||||
const std = @import("index.zig");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const mem = @import("mem.zig");
|
||||
const mem = std.mem;
|
||||
const Allocator = mem.Allocator;
|
||||
|
||||
/// Generic doubly linked list.
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
//
|
||||
// - acos(x) = nan if x < -1 or x > 1
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn acos(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - acosh(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn acosh(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
// - asin(+-0) = +-0
|
||||
// - asin(x) = nan if x < -1 or x > 1
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn asin(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - asinh(+-inf) = +-inf
|
||||
// - asinh(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn asinh(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
// - atan(+-0) = +-0
|
||||
// - atan(+-inf) = +-pi/2
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn atan(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
// atan2(+inf, x) = +pi/2
|
||||
// atan2(-inf, x) = -pi/2
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
fn atan2(comptime T: type, x: T, y: T) -> T {
|
||||
return switch (T) {
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - atanh(x) = nan if |x| > 1 with signal
|
||||
// - atanh(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn atanh(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - cbrt(+-inf) = +-inf
|
||||
// - cbrt(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn cbrt(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - ceil(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn ceil(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn copysign(comptime T: type, x: T, y: T) -> T {
|
||||
return switch (T) {
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - cos(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn cos(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
// - cosh(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const expo2 = @import("expo2.zig").expo2;
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn cosh(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
// - exp(+inf) = +inf
|
||||
// - exp(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn exp(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
// - exp2(+inf) = +inf
|
||||
// - exp2(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn exp2(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - expm1(-inf) = -1
|
||||
// - expm1(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn expm1(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
// - fabs(+-inf) = +inf
|
||||
// - fabs(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn fabs(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - floor(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const math = @import("index.zig");
|
||||
const assert = std.debug.assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
|
||||
pub fn floor(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn fma(comptime T: type, x: T, y: T, z: T) -> T {
|
||||
return switch (T) {
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - frexp(+-inf) = +-inf, 0
|
||||
// - frexp(nan) = nan, undefined
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
fn frexp_result(comptime T: type) -> type {
|
||||
return struct {
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - hypot(nan, y) = nan
|
||||
// - hypot(x, nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn hypot(comptime T: type, x: T, y: T) -> T {
|
||||
return switch (T) {
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - ilogb(0) = @maxValue(i32)
|
||||
// - ilogb(nan) = @maxValue(i32)
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn ilogb(x: var) -> i32 {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const builtin = @import("builtin");
|
||||
const std = @import("../index.zig");
|
||||
const TypeId = builtin.TypeId;
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub const e = 2.71828182845904523536028747135266249775724709369995;
|
||||
pub const pi = 3.14159265358979323846264338327950288419716939937510;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn inf(comptime T: type) -> T {
|
||||
return switch (T) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn isFinite(x: var) -> bool {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn isInf(x: var) -> bool {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn isNan(x: var) -> bool {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn isNormal(x: var) -> bool {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - ln(x) = nan if x < 0
|
||||
// - ln(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
const builtin = @import("builtin");
|
||||
const TypeId = builtin.TypeId;
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const math = @import("index.zig");
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const builtin = @import("builtin");
|
||||
const TypeId = builtin.TypeId;
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn log(comptime T: type, base: T, x: T) -> T {
|
||||
if (base == 2) {
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - log10(x) = nan if x < 0
|
||||
// - log10(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
const builtin = @import("builtin");
|
||||
const TypeId = builtin.TypeId;
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
// - log1p(x) = nan if x < -1
|
||||
// - log1p(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn log1p(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - log2(x) = nan if x < 0
|
||||
// - log2(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
const builtin = @import("builtin");
|
||||
const TypeId = builtin.TypeId;
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
// - modf(+-inf) = +-inf, nan
|
||||
// - modf(nan) = nan, nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
fn modf_result(comptime T: type) -> type {
|
||||
return struct {
|
||||
|
|
|
@ -22,8 +22,9 @@
|
|||
// pow(x, y) = nan for finite x < 0 and finite non-integer y
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
// This implementation is taken from the go stlib, musl is a bit more complex.
|
||||
pub fn pow(comptime T: type, x: T, y: T) -> T {
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - round(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const math = @import("index.zig");
|
||||
const assert = std.debug.assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
|
||||
pub fn round(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn scalbn(x: var, n: i32) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn signbit(x: var) -> bool {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - sin(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn sin(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - sinh(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
const expo2 = @import("expo2.zig").expo2;
|
||||
|
||||
pub fn sinh(x: var) -> @typeOf(x) {
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - sqrt(x) = nan if x < 0
|
||||
// - sqrt(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
const builtin = @import("builtin");
|
||||
const TypeId = builtin.TypeId;
|
||||
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - tan(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn tan(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
// - sinh(nan) = nan
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
const expo2 = @import("expo2.zig").expo2;
|
||||
|
||||
pub fn tanh(x: var) -> @typeOf(x) {
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
// - trunc(+-inf) = +-inf
|
||||
// - trunc(nan) = nan
|
||||
|
||||
const math = @import("index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const math = std.math;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub fn trunc(x: var) -> @typeOf(x) {
|
||||
const T = @typeOf(x);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const debug = @import("debug.zig");
|
||||
const std = @import("index.zig");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const math = @import("math/index.zig");
|
||||
const math = std.math;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
error OutOfMemory;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const linux = @import("os/linux.zig");
|
||||
const assert = @import("debug.zig").assert;
|
||||
const endian = @import("endian.zig");
|
||||
const std = @import("index.zig");
|
||||
const linux = std.os.linux;
|
||||
const assert = std.debug.assert;
|
||||
const endian = std.endian;
|
||||
|
||||
error SigInterrupt;
|
||||
error Io;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const c = @import("../c/index.zig");
|
||||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const c = std.c;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub use @import("darwin_errno.zig");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const std = @import("../index.zig");
|
||||
const builtin = @import("builtin");
|
||||
const Os = builtin.Os;
|
||||
const is_windows = builtin.os == Os.windows;
|
||||
|
@ -37,22 +38,22 @@ pub const createWindowsEnvBlock = windows_util.createWindowsEnvBlock;
|
|||
|
||||
pub const FileHandle = if (is_windows) windows.HANDLE else i32;
|
||||
|
||||
const debug = @import("../debug.zig");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
|
||||
const c = @import("../c/index.zig");
|
||||
const c = std.c;
|
||||
|
||||
const mem = @import("../mem.zig");
|
||||
const mem = std.mem;
|
||||
const Allocator = mem.Allocator;
|
||||
|
||||
const BufMap = @import("../buf_map.zig").BufMap;
|
||||
const cstr = @import("../cstr.zig");
|
||||
const BufMap = std.BufMap;
|
||||
const cstr = std.cstr;
|
||||
|
||||
const io = @import("../io.zig");
|
||||
const base64 = @import("../base64.zig");
|
||||
const ArrayList = @import("../array_list.zig").ArrayList;
|
||||
const Buffer = @import("../buffer.zig").Buffer;
|
||||
const math = @import("../index.zig").math;
|
||||
const io = std.io;
|
||||
const base64 = std.base64;
|
||||
const ArrayList = std.ArrayList;
|
||||
const Buffer = std.Buffer;
|
||||
const math = std.math;
|
||||
|
||||
error SystemResources;
|
||||
error AccessDenied;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const assert = @import("../debug.zig").assert;
|
||||
const std = @import("../index.zig");
|
||||
const assert = std.debug.assert;
|
||||
const builtin = @import("builtin");
|
||||
const arch = switch (builtin.arch) {
|
||||
builtin.Arch.x86_64 => @import("linux_x86_64.zig"),
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
const std = @import("../index.zig");
|
||||
const builtin = @import("builtin");
|
||||
const Os = builtin.Os;
|
||||
const debug = @import("../debug.zig");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const mem = @import("../mem.zig");
|
||||
const fmt = @import("../fmt/index.zig");
|
||||
const mem = std.mem;
|
||||
const fmt = std.fmt;
|
||||
const Allocator = mem.Allocator;
|
||||
const os = @import("index.zig");
|
||||
const math = @import("../math/index.zig");
|
||||
const os = std.os;
|
||||
const math = std.math;
|
||||
const posix = os.posix;
|
||||
const windows = os.windows;
|
||||
const c = @import("../c/index.zig");
|
||||
const cstr = @import("../cstr.zig");
|
||||
const cstr = std.cstr;
|
||||
|
||||
pub const sep_windows = '\\';
|
||||
pub const sep_posix = '/';
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
const std = @import("index.zig");
|
||||
const builtin = @import("builtin");
|
||||
const assert = @import("debug.zig").assert;
|
||||
const assert = std.debug.assert;
|
||||
const rand_test = @import("rand_test.zig");
|
||||
const mem = @import("mem.zig");
|
||||
const math = @import("math/index.zig");
|
||||
const mem = std.mem;
|
||||
const math = std.math;
|
||||
|
||||
pub const MT19937_32 = MersenneTwister(
|
||||
u32, 624, 397, 31,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunsdfdi = @import("fixunsdfdi.zig").__fixunsdfdi;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunsdfdi(a: f64, expected: u64) {
|
||||
const x = __fixunsdfdi(a);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunsdfsi = @import("fixunsdfsi.zig").__fixunsdfsi;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunsdfsi(a: f64, expected: u32) {
|
||||
const x = __fixunsdfsi(a);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunsdfti = @import("fixunsdfti.zig").__fixunsdfti;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunsdfti(a: f64, expected: u128) {
|
||||
const x = __fixunsdfti(a);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunssfdi = @import("fixunssfdi.zig").__fixunssfdi;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunssfdi(a: f32, expected: u64) {
|
||||
const x = __fixunssfdi(a);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunssfsi = @import("fixunssfsi.zig").__fixunssfsi;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunssfsi(a: f32, expected: u32) {
|
||||
const x = __fixunssfsi(a);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunssfti = @import("fixunssfti.zig").__fixunssfti;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunssfti(a: f32, expected: u128) {
|
||||
const x = __fixunssfti(a);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunstfdi = @import("fixunstfdi.zig").__fixunstfdi;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunstfdi(a: f128, expected: u64) {
|
||||
const x = __fixunstfdi(a);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunstfsi = @import("fixunstfsi.zig").__fixunstfsi;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunstfsi(a: f128, expected: u32) {
|
||||
const x = __fixunstfsi(a);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const __fixunstfti = @import("fixunstfti.zig").__fixunstfti;
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
fn test__fixunstfti(a: f128, expected: u128) {
|
||||
const x = __fixunstfti(a);
|
||||
|
|
|
@ -68,7 +68,7 @@ comptime {
|
|||
}
|
||||
}
|
||||
|
||||
const assert = @import("../../debug.zig").assert;
|
||||
const assert = @import("../../index.zig").debug.assert;
|
||||
|
||||
const __udivmoddi4 = @import("udivmoddi4.zig").__udivmoddi4;
|
||||
|
||||
|
|
Loading…
Reference in New Issue