← Back to
Home
page
Devlog
This page contains a curated list of recent changes to main branch Zig.
Also available as an RSS feed.
2024-09-16
Author: Andrew Kelley
I've been porting stb_truetype.h to Zig on the side. Check out this snippet:
{
float sum = 0;
for (i=0; i < result->w; ++i) {
float k;
int m;
sum += scanline2[i];
k = scanline[i] + sum;
k = (float) STBTT_fabs(k)*255 + 0.5f;
m = (int) k;
if (m > 255) m = 255;
result->pixels[j*result->stride + i] = (unsigned char) m;
}
}
⬇️
{
var sum: f32 = 0;
for (scanline, scanline2, result.pixels[j*result.stride..][0..result.w]) |s, s2, *p| {
sum += s2;
p.* = @min(@abs(s + sum)*255 + 0.5, 255);
}
}
Ahh, much better.
Zig tokenizer updated to use labeled switch statements
Author: Andrew Kelley
Now that Matthew landed labeled switch continue syntax, it's time to start using it.
Eric Petersen swooped in for a first-time contribution, updating Zig's tokenizer to use the new syntax, measuring a 13% wall time performance increase for the zig ast-check
command:
This line of code tickles me:
state: switch (State.start) {