Conversation Between Deadly Uzi and Netty

2 Visitor Messages

  1. Thanks a lot for that information you posted. Helpful and interesting.
  2. Your code:
    Code:
    (((coordinate >> 3) / 8) << 3) * 8
    simpler:
    Code:
    (((coordinate >> 3) >> 3) << 3) << 3
    simplest:
    Code:
    (coordinate >> 6) << 6
    Divides by 64, then multiplies by 64, which clears the last 6 bits of coordinate, getting the highest number that is divisible by 64 that is less than or equal to coordinate.

    It's the same thing as
    Code:
    (coordinate / 64) * 64
    and
    Code:
    coordinate & ~63
    But multiply and divide by powers of 2 is much slower than bit shifting.
Showing Visitor Messages 1 to 2 of 2