Re:Poll: How many programmers don't know about bit-wise oper...
by shdon on Sunday April 07, 2013 @06:28AM
(#5506722)
((width * bytes_per_pixel)+3&~3) anyone? Can't remember how many times I've done that for Windows bitmap stride. WORD/DWORD/QWORD alignment was something I had to do frequently in C or C++ code. Even fixed point math for speed in the really old days.
[ Parent
| on HN ]
Re:Poll: How many programmers don't know about bit-wise oper...
by dspeyer on Sunday April 07, 2013 @09:03AM
(#5507061)
That's a code snippet where extra parenthesis might help. The first several times I read it as:
((width * bytes_per_pixel)+(3&~3))
and thought "what's the point?"I don't know why bitwise ops are so low precedence. They've always felt more like multiplication to me.