Translates bytes to halves (int/short).
(State s, int byteLen)
| 293 | * Translates bytes to halves (int/short). |
| 294 | */ |
| 295 | static void bytesToNibbles(State s, int byteLen) { |
| 296 | final byte[] byteBuffer = s.byteBuffer; |
| 297 | final int halfLen = byteLen >> LOG_HALF_SIZE; |
| 298 | if (BITNESS == 64) { |
| 299 | final int[] intBuffer = s.intBuffer; |
| 300 | for (int i = 0; i < halfLen; ++i) { |
| 301 | intBuffer[i] = ((int) byteBuffer[i * 4] & 0xFF) |
| 302 | | (((int) byteBuffer[(i * 4) + 1] & 0xFF) << 8) |
| 303 | | (((int) byteBuffer[(i * 4) + 2] & 0xFF) << 16) |
| 304 | | (((int) byteBuffer[(i * 4) + 3] & 0xFF) << 24); |
| 305 | } |
| 306 | } else { |
| 307 | final short[] shortBuffer = s.shortBuffer; |
| 308 | for (int i = 0; i < halfLen; ++i) { |
| 309 | shortBuffer[i] = (short) (((int) byteBuffer[i * 2] & 0xFF) |
| 310 | | (((int) byteBuffer[(i * 2) + 1] & 0xFF) << 8)); |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | } |