I don't think these checking lines make sense.
It should be 
``` 
if (mateId != (mateId << mateIdShift) >>> mateIdShift))
```