|
You are here |
gcc.godbolt.org | ||
| | | | |
healeycodes.com
|
|
| | | | | Making my programming language 4000x quicker, and adding a static type checker. | |
| | | | |
zig.godbolt.org
|
|
| | | | | const std = @import("std"); const testing = std.testing; const utfValidator = struct { const State = enum(u6) { ok, one, two, three, fail, }; fn step(char: u8, state: State) State { return switch (state) { .ok => switch (char) { 0x00...0x7f => .ok, 0xc0...0xdf => .one, 0xe0...0xef => .two, 0xf0...0xf7 => .three, else => .fail, }, .one => switch (char) { 0x80...0xbf => .ok, else => .fail, }, .two => switch (char) { 0x80...0xbf => .one, else => .fail, }, .three => switch (char) { 0x80...0xbf => .two, else => .fail, }, .fail => .fail, }; } }; fn pext(val: u64, mask: u64) callconv(.Inline) u64 { return asm("pext %[m],%[v],%[r]":[r] "=r" (-> u64) : [v] "r" (val), [m] "r" (mask)); } pub fn is_utf8(data: []const u8) bool { const table1 = comptime init: { var tmp = ... | |
| | | | |
lukevanderhart.com
|
|
| | | | | ||
| | | | |
lazarusoverlook.com
|
|
| | | Learn the basics of the GNU Debugger. | ||