News for hackers. Stuff that matters.
Re:A 100LOC C impl of memset, that is faster than glibc's by kevin_b_er on Friday November 12, 2021 @02:38PM (#29203644)
Probably poorly. It is a violation to cast an unaligned pointer to an aligned type that the base pointer is not aligned for. And the code looks like it does just that right here: https://github.com/nadavrot/memset_benchmark/blob/main/src/l...

This is undefined behavior under C99 §6.3.2.3 Paragraph 7. "If the resulting pointer is not correctly aligned for the pointed-to type, the behavior is undefined."

The musl code referenced has handling for this.

There are no comments on this comment yet.