Skip to content

Instantly share code, notes, and snippets.

View alexei-zaripov's full-sized avatar

Alexei Zaripov alexei-zaripov

View GitHub Profile

C/C++ performance pitfall: int8_t, aliasing and the ways out

When I was working on a generic port of Google's hashmap to C, I wrote a function that (ignoring irrelevant parts) looked like this:

typedef struct {
    uint8_t *bytes;
    size_t len;
} bytebuf;