4 ms·
One example (taken from the real world): addr = (addr + PAGESIZE - 1) & ~PAGESIZE; contrast with addr = P2ALIGN(addr); The former is idiomatic and imm
by FullyFunctional 7y ago
One example (taken from the real world):
addr = (addr + PAGESIZE - 1) & ~PAGESIZE;
contrast with
addr = P2ALIGN(addr);
The former is idiomatic and immediately readable. For the latter I have to go lookup the definition of P2ALIGN (and make sure I got the one actually used as there may be multiple!), check that it does what I expect, and memorize it.
The value of abstracting the idiom is debatable. If it _is_ used sufficiently often, then it might be worthwhile, but often it isn't.