> inode->i_blocks = bytes >> 9;
> inode->i_blocks = BYTES_TO_BLOCKS(bytes);
It's a bit of an unfair example, though, because you're computing
against a value called "bytes" and assigning it to something called
"blocks". You've put enough context around the expression to make
it clear what the shift is trying to accomplish.
The problem is when someone assumes ">> 9" is inherently
self-documenting and throws it into the middle of a much more
complex statement. Consider:
process_frag_2(sig,(get_ent(curr) >> 9) + 2,HEX_ENCODE);
process_frag_2(sig,BYTES_TO_BLOCKS(get_ent(curr)) + 2,HEX_ENCODE);
When I'm reading code, I'd much rather see the latter. It doesn't
just tell me why the shift is being done; it even adds useful
information about the APIs for get_ent() and process_frag_2().