diff --git a/src/main/java/com/dynatrace/hash4j/hashing/AbstractFarmHash.java b/src/main/java/com/dynatrace/hash4j/hashing/AbstractFarmHash.java index 94ad9d98..c5d9d564 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/AbstractFarmHash.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/AbstractFarmHash.java @@ -272,12 +272,11 @@ private void processBuffer() { @Override public final HashStream64 putByte(byte v) { - buffer[bufferCount] = v; if (bufferCount >= 72) { processBuffer(); bufferCount = 8; - buffer[8] = v; } + buffer[bufferCount] = v; bufferCount += 1; return this; } @@ -294,6 +293,18 @@ public final HashStream64 putShort(short v) { return this; } + @Override + public final HashStream64 putChar(char v) { + setChar(buffer, bufferCount, v); + if (bufferCount >= 71) { + processBuffer(); + bufferCount -= 64; + setChar(buffer, bufferCount, v); + } + bufferCount += 2; + return this; + } + @Override public final HashStream64 putInt(int v) { setInt(buffer, bufferCount, v); @@ -370,68 +381,56 @@ public final HashStream64 putBytes(byte[] b, int off, int len) { @Override public final HashStream64 putChars(CharSequence s) { - if (bufferCount + s.length() * 2L < 73) { - for (int idx = 0; idx < s.length(); idx += 1) { - setChar(buffer, bufferCount + (idx << 1), s.charAt(idx)); - } - bufferCount += s.length() << 1; - return this; - } int idx = 0; - while (bufferCount < 72) { - setChar(buffer, bufferCount, s.charAt(idx)); - bufferCount += 2; - idx += 1; - } - processBuffer(); - int a = bufferCount & 1; - bufferCount = 8 - a; - idx -= a; - int lenMinus32 = s.length() - 32; - if (idx < lenMinus32) { - while (true) { - - long b0 = getLong(s, idx); - long b1 = getLong(s, idx + 4); - long b2 = getLong(s, idx + 8); - long b3 = getLong(s, idx + 12); - long b4 = getLong(s, idx + 16); - long b5 = getLong(s, idx + 20); - long b6 = getLong(s, idx + 24); - long b7 = getLong(s, idx + 28); - - if (a != 0) { - b0 = (b0 >>> 8) | (b1 << 56); - b1 = (b1 >>> 8) | (b2 << 56); - b2 = (b2 >>> 8) | (b3 << 56); - b3 = (b3 >>> 8) | (b4 << 56); - b4 = (b4 >>> 8) | (b5 << 56); - b5 = (b5 >>> 8) | (b6 << 56); - b6 = (b6 >>> 8) | (b7 << 56); - b7 = (b7 >>> 8) | ((long) s.charAt(idx + 32) << 56); - } + if (s.length() >= ((74 - bufferCount) >> 1)) { + idx = ((73 - bufferCount) >>> 1); + copyCharsToByteArray(s, 0, buffer, bufferCount, idx); + processBuffer(); + int a = bufferCount & 1; + bufferCount = 8 - a; + idx -= a; + int lenMinus32 = s.length() - 32; + if (idx < lenMinus32) { + while (true) { + + long b0 = getLong(s, idx); + long b1 = getLong(s, idx + 4); + long b2 = getLong(s, idx + 8); + long b3 = getLong(s, idx + 12); + long b4 = getLong(s, idx + 16); + long b5 = getLong(s, idx + 20); + long b6 = getLong(s, idx + 24); + long b7 = getLong(s, idx + 28); + + if (a != 0) { + b0 = (b0 >>> 8) | (b1 << 56); + b1 = (b1 >>> 8) | (b2 << 56); + b2 = (b2 >>> 8) | (b3 << 56); + b3 = (b3 >>> 8) | (b4 << 56); + b4 = (b4 >>> 8) | (b5 << 56); + b5 = (b5 >>> 8) | (b6 << 56); + b6 = (b6 >>> 8) | (b7 << 56); + b7 = (b7 >>> 8) | ((long) s.charAt(idx + 32) << 56); + } - processBuffer(b0, b1, b2, b3, b4, b5, b6, b7); - idx += 32; - if (idx >= lenMinus32) { - setLong(buffer, 8, b0); - setLong(buffer, 16, b1); - setLong(buffer, 24, b2); - setLong(buffer, 32, b3); - setLong(buffer, 40, b4); - setLong(buffer, 48, b5); - setLong(buffer, 56, b6); - setLong(buffer, 64, b7); - break; + processBuffer(b0, b1, b2, b3, b4, b5, b6, b7); + idx += 32; + if (idx >= lenMinus32) { + setLong(buffer, 8, b0); + setLong(buffer, 16, b1); + setLong(buffer, 24, b2); + setLong(buffer, 32, b3); + setLong(buffer, 40, b4); + setLong(buffer, 48, b5); + setLong(buffer, 56, b6); + setLong(buffer, 64, b7); + break; + } } } } - - do { - setChar(buffer, bufferCount, s.charAt(idx)); - bufferCount += 2; - idx += 1; - } while (idx < s.length()); + copyCharsToByteArray(s, idx, buffer, bufferCount, s.length() - idx); + bufferCount += (s.length() - idx) << 1; return this; } diff --git a/src/main/java/com/dynatrace/hash4j/hashing/AbstractHashStream.java b/src/main/java/com/dynatrace/hash4j/hashing/AbstractHashStream.java index 139284dc..dd19ca9f 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/AbstractHashStream.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/AbstractHashStream.java @@ -35,8 +35,35 @@ public HashStream putBooleans(boolean[] x) { @Override public HashStream putBooleans(boolean[] x, int off, int len) { - for (int i = 0; i < len; i++) { - putBoolean(x[off + i]); + int end = len + off; + while (off <= end - 8) { + long b0 = (x[off + 0] ? 1L : 0L) << (8 * 0); + long b1 = (x[off + 1] ? 1L : 0L) << (8 * 1); + long b2 = (x[off + 2] ? 1L : 0L) << (8 * 2); + long b3 = (x[off + 3] ? 1L : 0L) << (8 * 3); + long b4 = (x[off + 4] ? 1L : 0L) << (8 * 4); + long b5 = (x[off + 5] ? 1L : 0L) << (8 * 5); + long b6 = (x[off + 6] ? 1L : 0L) << (8 * 6); + long b7 = (x[off + 7] ? 1L : 0L) << (8 * 7); + putLong(b0 | b1 | b2 | b3 | b4 | b5 | b6 | b7); + off += 8; + } + if (off <= end - 4) { + int b0 = (x[off + 0] ? 1 : 0) << (8 * 0); + int b1 = (x[off + 1] ? 1 : 0) << (8 * 1); + int b2 = (x[off + 2] ? 1 : 0) << (8 * 2); + int b3 = (x[off + 3] ? 1 : 0) << (8 * 3); + putInt(b0 | b1 | b2 | b3); + off += 4; + } + if (off <= end - 2) { + int b0 = (x[off + 0] ? 1 : 0) << (8 * 0); + int b1 = (x[off + 1] ? 1 : 0) << (8 * 1); + putChar((char) (b0 | b1)); + off += 2; + } + if (off < end) { + putBoolean(x[off]); } return this; } @@ -54,8 +81,21 @@ public HashStream putBytes(byte[] b) { @Override public HashStream putBytes(byte[] b, int off, int len) { - for (int i = 0; i < len; i++) { - putByte(b[off + i]); + int end = len + off; + while (off <= end - 8) { + putLong(AbstractHasher.getLong(b, off)); + off += 8; + } + if (off <= end - 4) { + putInt(AbstractHasher.getInt(b, off)); + off += 4; + } + if (off <= end - 2) { + putChar(AbstractHasher.getChar(b, off)); + off += 2; + } + if (off < end) { + putByte(b[off]); } return this; } @@ -78,17 +118,41 @@ public HashStream putChars(char[] x) { @Override public HashStream putChars(char[] x, int off, int len) { - for (int i = 0; i < len; i++) { - putChar(x[off + i]); + int end = len + off; + while (off <= end - 4) { + long b0 = (long) x[off + 0] << (16 * 0); + long b1 = (long) x[off + 1] << (16 * 1); + long b2 = (long) x[off + 2] << (16 * 2); + long b3 = (long) x[off + 3] << (16 * 3); + putLong(b0 | b1 | b2 | b3); + off += 4; + } + if (off <= end - 2) { + int b0 = x[off + 0] << (16 * 0); + int b1 = x[off + 1] << (16 * 1); + putInt(b0 | b1); + off += 2; + } + if (off < end) { + putChar(x[off]); } return this; } @Override public HashStream putChars(CharSequence s) { - int len = s.length(); - for (int i = 0; i < len; i++) { - putChar(s.charAt(i)); + int end = s.length(); + int off = 0; + while (off <= end - 4) { + putLong(AbstractHasher.getLong(s, off)); + off += 4; + } + if (off <= end - 2) { + putInt(AbstractHasher.getInt(s, off)); + off += 2; + } + if (off < end) { + putChar(s.charAt(off)); } return this; } @@ -124,8 +188,23 @@ public HashStream putShorts(short[] x) { @Override public HashStream putShorts(short[] x, int off, int len) { - for (int i = 0; i < len; i++) { - putShort(x[off + i]); + int end = off + len; + while (off <= end - 4) { + long b0 = (x[off + 0] & 0xFFFFL) << (16 * 0); + long b1 = (x[off + 1] & 0xFFFFL) << (16 * 1); + long b2 = (x[off + 2] & 0xFFFFL) << (16 * 2); + long b3 = (x[off + 3] & 0xFFFFL) << (16 * 3); + putLong(b0 | b1 | b2 | b3); + off += 4; + } + if (off <= end - 2) { + int b0 = (x[off + 0] & 0xFFFF) << (16 * 0); + int b1 = (x[off + 1] & 0xFFFF) << (16 * 1); + putInt(b0 | b1); + off += 2; + } + if (off < end) { + putShort(x[off]); } return this; } @@ -151,8 +230,15 @@ public HashStream putInts(int[] x) { @Override public HashStream putInts(int[] x, int off, int len) { - for (int i = 0; i < len; i++) { - putInt(x[off + i]); + int end = off + len; + while (off <= end - 2) { + long b0 = x[off + 0] & 0xFFFFFFFFL; + long b1 = (long) x[off + 1] << 32; + putLong(b0 | b1); + off += 2; + } + if (off < end) { + putInt(x[off]); } return this; } @@ -195,8 +281,15 @@ public HashStream putFloats(float[] x) { @Override public HashStream putFloats(float[] x, int off, int len) { - for (int i = 0; i < len; ++i) { - putFloat(x[off + i]); + int end = off + len; + while (off <= end - 2) { + long b0 = Float.floatToRawIntBits(x[off + 0]) & 0xFFFFFFFFL; + long b1 = (long) Float.floatToRawIntBits(x[off + 1]) << 32; + putLong(b0 | b1); + off += 2; + } + if (off < end) { + putFloat(x[off]); } return this; } diff --git a/src/main/java/com/dynatrace/hash4j/hashing/AbstractHasher.java b/src/main/java/com/dynatrace/hash4j/hashing/AbstractHasher.java index ff294c59..78f4928a 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/AbstractHasher.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/AbstractHasher.java @@ -74,4 +74,32 @@ protected static int getInt(CharSequence s, int off) { protected static void setChar(byte[] b, int off, char v) { CHAR_HANDLE.set(b, off, v); } + + protected static void copyCharsToByteArray( + CharSequence charSequence, + int offetCharSequence, + byte[] byteArray, + int offsetByteArray, + int numChars) { + for (int charIdx = 0; charIdx <= numChars - 4; charIdx += 4) { + setLong( + byteArray, + offsetByteArray + (charIdx << 1), + getLong(charSequence, offetCharSequence + charIdx)); + } + if ((numChars & 2) != 0) { + int charIdx = numChars & 0xFFFFFFFC; + setInt( + byteArray, + offsetByteArray + (charIdx << 1), + getInt(charSequence, offetCharSequence + charIdx)); + } + if ((numChars & 1) != 0) { + int charIdx = numChars & 0xFFFFFFFE; + setChar( + byteArray, + offsetByteArray + (charIdx << 1), + charSequence.charAt(offetCharSequence + charIdx)); + } + } } diff --git a/src/main/java/com/dynatrace/hash4j/hashing/AbstractKomihash.java b/src/main/java/com/dynatrace/hash4j/hashing/AbstractKomihash.java index 6a899bcb..31e8df1a 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/AbstractKomihash.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/AbstractKomihash.java @@ -194,23 +194,12 @@ public HashStream64 putChars(CharSequence s) { int offset = (int) byteCount & 0x3F; byteCount += ((long) remainingChars) << 1; int off = 0; - if (remainingChars >= ((65 - offset) >>> 1)) { + int x = (65 - offset) >>> 1; + if (remainingChars >= x) { if (offset > 1) { - while (offset < 58) { - setLong(buffer, offset, getLong(s, off)); - off += 4; - offset += 8; - } - if (offset < 62) { - setInt(buffer, offset, getInt(s, off)); - off += 2; - offset += 4; - } - if (offset < 64) { - setChar(buffer, offset, s.charAt(off)); - off += 1; - } - remainingChars -= off; + copyCharsToByteArray(s, 0, buffer, offset, x); + remainingChars -= x; + off = x; processBuffer(); offset &= 1; if (offset != 0) { @@ -263,21 +252,7 @@ public HashStream64 putChars(CharSequence s) { } } } - while (remainingChars >= 4) { - setLong(buffer, offset, getLong(s, off)); - off += 4; - offset += 8; - remainingChars -= 4; - } - if (remainingChars >= 2) { - setInt(buffer, offset, getInt(s, off)); - off += 2; - offset += 4; - remainingChars -= 2; - } - if (remainingChars != 0) { - setChar(buffer, offset, s.charAt(off)); - } + copyCharsToByteArray(s, off, buffer, offset, remainingChars); return this; } diff --git a/src/main/java/com/dynatrace/hash4j/hashing/AbstractWyhashFinal.java b/src/main/java/com/dynatrace/hash4j/hashing/AbstractWyhashFinal.java index 7dce0dbc..17cd0e86 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/AbstractWyhashFinal.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/AbstractWyhashFinal.java @@ -283,14 +283,13 @@ public HashStream64 copy() { @Override public HashStream64 putByte(byte v) { - buffer[offset] = v; - offset += 1; - byteCount += 1; - if (offset > 48) { + if (offset >= 48) { offset -= 48; processBuffer(); - buffer[0] = buffer[48]; } + buffer[offset] = v; + offset += 1; + byteCount += 1; return this; } @@ -353,23 +352,24 @@ public HashStream64 putBytes(byte[] b, int off, int len) { if (len > x) { System.arraycopy(b, off, buffer, offset, x); processBuffer(); - int lenOrig = len; len -= x; off += x; - while (len > 48) { - long b0 = getLong(b, off); - long b1 = getLong(b, off + 8); - long b2 = getLong(b, off + 16); - long b3 = getLong(b, off + 24); - long b4 = getLong(b, off + 32); - long b5 = getLong(b, off + 40); - processBuffer(b0, b1, b2, b3, b4, b5); - off += 48; - len -= 48; - } - int y = 16 - len; - if (lenOrig > 48 && y > 0) { - System.arraycopy(b, off - y, buffer, 32 + len, y); + if (len > 48) { + do { + long b0 = getLong(b, off); + long b1 = getLong(b, off + 8); + long b2 = getLong(b, off + 16); + long b3 = getLong(b, off + 24); + long b4 = getLong(b, off + 32); + long b5 = getLong(b, off + 40); + processBuffer(b0, b1, b2, b3, b4, b5); + off += 48; + len -= 48; + } while (len > 48); + if (len < 16) { + int y = 16 - len; + System.arraycopy(b, off - y, buffer, 32 + len, y); + } } offset = 0; } @@ -385,21 +385,8 @@ public HashStream64 putChars(CharSequence s) { int off = 0; if (remainingChars > ((48 - offset) >>> 1)) { if (offset > 1) { - while (offset < 42) { - setLong(buffer, offset, getLong(s, off)); - off += 4; - offset += 8; - } - if (offset < 46) { - setInt(buffer, offset, getInt(s, off)); - off += 2; - offset += 4; - } - if (offset < 48) { - setChar(buffer, offset, s.charAt(off)); - off += 1; - offset += 2; - } + off = (49 - offset) >>> 1; + copyCharsToByteArray(s, 0, buffer, offset, off); remainingChars -= off; processBuffer(); offset &= 1; @@ -455,22 +442,8 @@ public HashStream64 putChars(CharSequence s) { buffer[0] = (byte) z; } } - while (remainingChars >= 4) { - setLong(buffer, offset, getLong(s, off)); - off += 4; - offset += 8; - remainingChars -= 4; - } - if (remainingChars >= 2) { - setInt(buffer, offset, getInt(s, off)); - off += 2; - offset += 4; - remainingChars -= 2; - } - if (remainingChars != 0) { - setChar(buffer, offset, s.charAt(off)); - offset += 2; - } + copyCharsToByteArray(s, off, buffer, offset, remainingChars); + offset += (remainingChars << 1); return this; } diff --git a/src/main/java/com/dynatrace/hash4j/hashing/HashStream64.java b/src/main/java/com/dynatrace/hash4j/hashing/HashStream64.java index 6720046d..4683a22b 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/HashStream64.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/HashStream64.java @@ -164,13 +164,6 @@ HashStream64 putUnorderedIterable( @Override HashStream64 putOptionalDouble(OptionalDouble v); - /** - * Resets the hash stream. - * - *

This allows to reuse this instance for new hash computations. - * - * @return this - */ @Override HashStream64 reset(); diff --git a/src/main/java/com/dynatrace/hash4j/hashing/Murmur3_128.java b/src/main/java/com/dynatrace/hash4j/hashing/Murmur3_128.java index 22bb3963..18699a55 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/Murmur3_128.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/Murmur3_128.java @@ -268,7 +268,15 @@ public HashStream128 putByte(byte b) { @Override public HashStream128 putShort(short v) { - final long l = v & 0xFFFFL; + return putTwoBytes(v & 0xFFFFL); + } + + @Override + public HashStream128 putChar(char v) { + return putTwoBytes(v); + } + + private HashStream128 putTwoBytes(long l) { buffer1 |= l << bitCount; if ((bitCount & 0x30L) == 0x30L) { if ((bitCount & 0x40L) != 0) { diff --git a/src/main/java/com/dynatrace/hash4j/hashing/Murmur3_32.java b/src/main/java/com/dynatrace/hash4j/hashing/Murmur3_32.java index 3411d6b5..2cdcfe63 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/Murmur3_32.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/Murmur3_32.java @@ -159,7 +159,16 @@ public HashStream32 putByte(byte b) { @Override public HashStream32 putShort(short v) { - buffer |= (v & 0xFFFFL) << shift; + return putTwoBytes(v & 0xFFFFL); + } + + @Override + public HashStream32 putChar(char v) { + return putTwoBytes(v); + } + + private HashStream32 putTwoBytes(long v) { + buffer |= v << shift; shift += 16; length += 2; if (shift >= 32) { diff --git a/src/main/java/com/dynatrace/hash4j/hashing/PolymurHash2_0.java b/src/main/java/com/dynatrace/hash4j/hashing/PolymurHash2_0.java index 1620ebb7..cb1b6c49 100644 --- a/src/main/java/com/dynatrace/hash4j/hashing/PolymurHash2_0.java +++ b/src/main/java/com/dynatrace/hash4j/hashing/PolymurHash2_0.java @@ -604,10 +604,6 @@ public HashStream64 putLong(long v) { @Override public HashStream64 putBytes(byte[] b, int off, int len) { - if (len == 0) { - return this; - } - byteCount += len; int x = 49 - offset; @@ -640,88 +636,81 @@ public HashStream64 putChars(CharSequence s) { int i = 0; byteCount += (long) s.length() << 1; - while (i < s.length() && offset <= 49) { - char v = s.charAt(i); - setChar(buffer, offset, v); - offset += 2; - i += 1; - } - if (offset > 49) { + if (s.length() >= (51 - offset) >>> 1) { + i = (51 - offset) >>> 1; + copyCharsToByteArray(s, 0, buffer, offset, i); + offset += i << 1; offset -= 49; processBuffer(); setChar(buffer, 0, getChar(buffer, 49)); + if (i <= s.length() - ((51 - offset) >>> 1)) { + long x = getChar(buffer, 0); + do { + long c1 = s.charAt(i + 0); + long c2 = s.charAt(i + 1); + long c3 = s.charAt(i + 2); + long c4 = s.charAt(i + 3); + long c5 = s.charAt(i + 4); + long c6 = s.charAt(i + 5); + long c7 = s.charAt(i + 6); + long c8 = s.charAt(i + 7); + long c9 = s.charAt(i + 8); + long c10 = s.charAt(i + 9); + long c11 = s.charAt(i + 10); + long c12 = s.charAt(i + 11); + long c13 = s.charAt(i + 12); + long c14 = s.charAt(i + 13); + long c15 = s.charAt(i + 14); + long c16 = s.charAt(i + 15); + long c17 = s.charAt(i + 16); + long c18 = s.charAt(i + 17); + long c19 = s.charAt(i + 18); + long c20 = s.charAt(i + 19); + long c21 = s.charAt(i + 20); + long c22 = s.charAt(i + 21); + long c23 = s.charAt(i + 22); + long c24 = s.charAt(i + 23); + long v0; + long v1; + long v2; + long v3; + long v4; + long v5; + long v6; + if (offset == 1) { + long c0 = (x & 0xFFL) << 8; + v0 = c0 | (c1 << 16) | (c2 << 32) | (c3 << 48); + v1 = (c4 << 8) | (c5 << 24) | (c6 << 40) | (c7 << 56); + v2 = c7 | (c8 << 16) | (c9 << 32) | (c10 << 48); + v3 = (c11 << 8) | (c12 << 24) | (c13 << 40) | (c14 << 56); + v4 = c14 | (c15 << 16) | (c16 << 32) | (c17 << 48); + v5 = (c18 << 8) | (c19 << 24) | (c20 << 40) | (c21 << 56); + v6 = c21 | (c22 << 16) | (c23 << 32) | (c24 << 48); + offset = 2; + x = s.charAt(i + 24); + i += 25; + } else { + long c0 = x; + v0 = (c0 << 8) | (c1 << 24) | (c2 << 40) | (c3 << 56); + v1 = c3 | (c4 << 16) | (c5 << 32) | (c6 << 48); + v2 = (c7 << 8) | (c8 << 24) | (c9 << 40) | (c10 << 56); + v3 = c10 | (c11 << 16) | (c12 << 32) | (c13 << 48); + v4 = (c14 << 8) | (c15 << 24) | (c16 << 40) | (c17 << 56); + v5 = c17 | (c18 << 16) | (c19 << 32) | (c20 << 48); + v6 = (c21 << 8) | (c22 << 24) | (c23 << 40) | (c24 << 56); + offset = 1; + x = c24 >>> 8; + i += 24; + } + h = + PolymurHash2_0.this.processBuffer( + v0 >>> 8, v1 >>> 8, v2 >>> 8, v3 >>> 8, v4 >>> 8, v5 >>> 8, v6 >>> 8, h); + } while (i <= s.length() - ((51 - offset) >>> 1)); + setChar(buffer, 0, (char) x); + } } - if (i <= s.length() - ((51 - offset) >>> 1)) { - long x = getChar(buffer, 0); - do { - long c1 = s.charAt(i + 0); - long c2 = s.charAt(i + 1); - long c3 = s.charAt(i + 2); - long c4 = s.charAt(i + 3); - long c5 = s.charAt(i + 4); - long c6 = s.charAt(i + 5); - long c7 = s.charAt(i + 6); - long c8 = s.charAt(i + 7); - long c9 = s.charAt(i + 8); - long c10 = s.charAt(i + 9); - long c11 = s.charAt(i + 10); - long c12 = s.charAt(i + 11); - long c13 = s.charAt(i + 12); - long c14 = s.charAt(i + 13); - long c15 = s.charAt(i + 14); - long c16 = s.charAt(i + 15); - long c17 = s.charAt(i + 16); - long c18 = s.charAt(i + 17); - long c19 = s.charAt(i + 18); - long c20 = s.charAt(i + 19); - long c21 = s.charAt(i + 20); - long c22 = s.charAt(i + 21); - long c23 = s.charAt(i + 22); - long c24 = s.charAt(i + 23); - long v0; - long v1; - long v2; - long v3; - long v4; - long v5; - long v6; - if (offset == 1) { - long c0 = (x & 0xFFL) << 8; - v0 = c0 | (c1 << 16) | (c2 << 32) | (c3 << 48); - v1 = (c4 << 8) | (c5 << 24) | (c6 << 40) | (c7 << 56); - v2 = c7 | (c8 << 16) | (c9 << 32) | (c10 << 48); - v3 = (c11 << 8) | (c12 << 24) | (c13 << 40) | (c14 << 56); - v4 = c14 | (c15 << 16) | (c16 << 32) | (c17 << 48); - v5 = (c18 << 8) | (c19 << 24) | (c20 << 40) | (c21 << 56); - v6 = c21 | (c22 << 16) | (c23 << 32) | (c24 << 48); - offset = 2; - x = s.charAt(i + 24); - i += 25; - } else { - long c0 = x; - v0 = (c0 << 8) | (c1 << 24) | (c2 << 40) | (c3 << 56); - v1 = c3 | (c4 << 16) | (c5 << 32) | (c6 << 48); - v2 = (c7 << 8) | (c8 << 24) | (c9 << 40) | (c10 << 56); - v3 = c10 | (c11 << 16) | (c12 << 32) | (c13 << 48); - v4 = (c14 << 8) | (c15 << 24) | (c16 << 40) | (c17 << 56); - v5 = c17 | (c18 << 16) | (c19 << 32) | (c20 << 48); - v6 = (c21 << 8) | (c22 << 24) | (c23 << 40) | (c24 << 56); - offset = 1; - x = c24 >>> 8; - i += 24; - } - h = - PolymurHash2_0.this.processBuffer( - v0 >>> 8, v1 >>> 8, v2 >>> 8, v3 >>> 8, v4 >>> 8, v5 >>> 8, v6 >>> 8, h); - } while (i <= s.length() - ((51 - offset) >>> 1)); - setChar(buffer, 0, (char) x); - } - while (i < s.length()) { - char v = s.charAt(i); - setChar(buffer, offset, v); - offset += 2; - i += 1; - } + copyCharsToByteArray(s, i, buffer, offset, s.length() - i); + offset += (s.length() - i) << 1; return this; }