We know we are partitioning integers, so we don't need pattern matching. This function implementation can be changed to

~~~
Utils.nonNegativeMod(byteswap32(x.asInstanceOf[Int]), numPartitions)
~~~