From 776dbf1ae6d658ce72f739d7339da4cfe77491cd Mon Sep 17 00:00:00 2001 From: xibxor Date: Sat, 7 Oct 2017 14:04:26 -0700 Subject: [PATCH] Aliasing optimization https://en.m.wikipedia.org/wiki/Restrict GCC's and Clang's __restrict__ will further let the compiler optimize the code. Can you rerun your tests? Should give at least another 10% perrformance boost. --- utf8.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utf8.h b/utf8.h index 419977d..0b275f5 100644 --- a/utf8.h +++ b/utf8.h @@ -23,7 +23,7 @@ * error, but it will always advance at least one byte. */ static void * -utf8_decode(void *buf, uint32_t *c, int *e) +utf8_decode(void *__restrict__ buf, uint32_t *__restrict__ c, int *__restrict__ e) { static const char lengths[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,