View delete-old-zig-builds.js
#!/usr/bin/env node
var fs = require('fs');
var s3 = require('s3');
var ini = require('ini');
var osenv = require('osenv');
var path = require('path');
var http = require('http');
var https = require('https');
var url = require('url');
View 0tcp_server.zig
const std = @import("std");
const event = std.event;
const mem = std.mem;
const assert = std.debug.assert;
pub fn main() !void {
const MyServer = struct {
tcp_server: event.TcpServer,
const Self = this;
View hello.go.strace
execve("./hello", ["./hello"], 0x7ffdfefa1a60 /* 61 vars */) = 0
arch_prctl(ARCH_SET_FS, 0x52b4f0) = 0
sched_getaffinity(0, 8192, [0, 1, 2, 3, 4, 5, 6, 7]) = 48
mmap(0xc000000000, 65536, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc000000000
munmap(0xc000000000, 65536) = 0
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa8c6ff8000
mmap(0xc420000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc420000000
mmap(0xc41fff8000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc41fff8000
mmap(0xc000000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc000000000
mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa8c6fe8000
View test.zig
const std = @import("std");
pub fn main() !void {
const epollfd = blk: {
const rc = std.os.linux.epoll_create1(std.os.linux.EPOLL_CLOEXEC);
const err = std.os.linux.getErrno(rc);
if (err != 0) return error.EpollCreateFailed;
break :blk i32(rc);
};
defer std.os.close(epollfd);
View windows_h.zig
This file has been truncated, but you can view the full file.
pub const va_list = ?&u8;
pub extern fn __va_start(arg0: ?&(?&u8));
pub const ptrdiff_t = c_longlong;
pub const __vcrt_bool = bool;
pub const wchar_t = c_ushort;
pub extern fn __security_init_cookie();
pub extern fn __security_check_cookie(_StackCookie: usize);
pub extern fn __report_gsfailure(_StackCookie: usize) -> noreturn;
pub extern var __security_cookie: usize;
View map.zig
const std = @import("std");
/// Can return error.OutOfMemory
/// Caller owns the returned memory
fn map(allocator: &std.mem.Allocator, comptime T: type, items: []const T, func: fn(T)->T) -> %[]T {
const new_items = try allocator.alloc(T, items.len);
%defer allocator.free(new_items);
for (items) |item, i| {
View sine.zig
const c = @cImport(@cInclude("soundio/soundio.h"));
const io = @import("std").io;
const cstr = @import("std").cstr;
const panic = @import("std").debug.panic;
const math = @import("std").math;
error NoMem;
error InitAudioBackend;
error SystemResources;
error OpeningDevice;
View output
[nix-shell:~/dev/zig/build]$ ./zig build_obj test2.zig
| "sin_result", 0.909297
| "fabs_result", 0.909297
| "fabs_bits", 1063831479
| "scaled_up", 3905402623.090703
| "anded", 3905402623
/home/andy/dev/zig/build/test2.zig:11:5: error: found compile log statement
@compileLog("sin_result", sin_result);
^
/home/andy/dev/zig/build/test2.zig:12:5: error: found compile log statement
View explanation.md

Note this:

call fastcc void @testEnumTagNameBare(%"[]u8"* %0, i2 -2), !dbg !29

We pass i2 -2 which is the unsigned value 2.

After optimizations, the value becomes i64 -2 which is the unsigned value 18446744073709551614.

View test1.ll
define i32 @main(i32, i32) {
%ok = icmp ult i32 %1, 32
br i1 %ok, label %ok_label, label %bad_label
ok_label:
ret i32 0
bad_label:
%a = lshr i32 %0, %1
ret i32 %a
}