Hacker News new | ask | show | jobs
by krzat 3219 days ago
Why not `x / 16`?
2 comments

Integer division will give a rounded result instead of floor
I think they're going for the ceiling here, not the floor. Truncation of positive values should be the same as a floor function.
Yes, I wrote the example. Then realized it was different and corrected only half of it.
Not in C..?

   (x + 15) / 16
Yes, which is more readable and would be compiled to the same thing