
Dear Stephen Warren,
In message 5331B4E4.5090101@wwwdotorg.org you wrote:
Please do not invent new bit manipulation functions. Just use the standard I/O accessors. And whenever possible, please remove pre- existing functions.
I've just recently sent patches to get rid of such "inventions" that resulted in undefined code.
That's not what this code is doing. The existing IO accessors are used; it's just removing duplication from the parameters passed to the existing functions (the shift needs to be written out twice).
Yes, I've seen that. You can save a little typ[ing this way. But you have to type it only once, and then maintain it forever. And the helper function obscures what is happening, which is bad. It makes the code more difficult to read and understand and maintain, especially when the shift count is not easily recognizable - at least I cannot really read what PULL_SHIFT(pin) decodes to.
Please make the code simple to read, use existing standard functions.
Best regards,
Wolfgang Denk