Fix for the next(int) function in AtomicQueue.

The calculation now uses remainder instead of bitwise AND.