Blogs / Personal blogs

NRK's Homepage

nrk.neocities.org

This is my personal site where I share things which I find interesting. As of now it is mostly tech related, but that might change in the future.

Popular posts
4
Total points
523
HN comments
446
Rank
#4,885 personal

Visit nrk.neocities.org → On Hacker News Sep 2023 – Nov 2024

Software Engineering 4Systems & Performance 2Security & Privacy 2

1

I'm not a fan of strlcpy(3)

strlcpy(3) is an OpenBSD function which is often hailed as a safer replacement for strcpy(3) and/or strncpy(3) . One of the obvious issues with strlcpy is that it's not safe if src isn't null-terminated. However, that's not the reason I don't like strlcpy. In fact despite knowing this, I used to think it was an okay…

3

Decoding UTF8 with parallel extract

As a side-quest I recently decided to write a branchless utf8 decoder utilizing the pext or "parallel extract" instruction. It's compliant with rfc-3629 , meaning that it doesn't just naively decode the code-point but also checks for overlong encoding, surrogate pairs and such. Compiled with gcc -O3 -march=x86-64-v3…