Hacker News new | ask | show | jobs
by syncsynchalt 4296 days ago
Same, I'd write it out using modulo and would assume the compiler would figure it out.

    void *p = x;
    p += 7;
    p -= (p%8);
Now that I've written it out I suppose it's not any clearer than the mask method:

    void *p = x;
    p += 7;
    p &= ~7;