4 ms·
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 jus
by kevin_b_er 5y ago
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/lib.c#L25 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.