mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
fc100d7b3b
* add `@compileLog(...)` builtin function - Helps debug code running at compile time - See #240 * fix crash when there is an error on the start value of a slice * add implicit cast from int and float types to int and float literals if the value is known at compile time * make array concatenation work with slices in addition to arrays and c string literals * fix compile error message for something not having field access * fix crash when `@setDebugSafety()` was called from a function being evaluated at compile-time * fix compile-time evaluation of overflow math builtins. * avoid debug safety panic handler in builtin.o and compiler_rt.o since we use no debug safety in these modules anyway * add compiler_rt functions for division on ARM - Closes #254 * move default panic handler to std.debug so users can call it manually * std.io.printf supports a width in the format specifier
37 lines
945 B
Zig
37 lines
945 B
Zig
// These functions are provided when not linking against libc because LLVM
|
|
// sometimes generates code that calls them.
|
|
|
|
// Note that these functions do not return `dest`, like the libc API.
|
|
// The semantics of these functions is dictated by the corresponding
|
|
// LLVM intrinsics, not by the libc API.
|
|
|
|
export fn memset(dest: ?&u8, c: u8, n: usize) {
|
|
@setDebugSafety(this, false);
|
|
|
|
if (n == 0)
|
|
return;
|
|
|
|
const d = ??dest;
|
|
var index: usize = 0;
|
|
while (index != n; index += 1)
|
|
d[index] = c;
|
|
}
|
|
|
|
export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) {
|
|
@setDebugSafety(this, false);
|
|
|
|
if (n == 0)
|
|
return;
|
|
|
|
const d = ??dest;
|
|
const s = ??src;
|
|
var index: usize = 0;
|
|
while (index != n; index += 1)
|
|
d[index] = s[index];
|
|
}
|
|
|
|
// Avoid dragging in the debug safety mechanisms into this .o file.
|
|
pub fn panic(message: []const u8) -> unreachable {
|
|
@unreachable();
|
|
}
|