Optimise ByteArrayTools with bitshifting