in src/main/java/org/apache/commons/codec/digest/XXHash32.java [93:131]
public void update(final byte[] b, int off, final int len) {
if (len <= 0) {
return;
}
totalLen += len;
final int end = off + len;
// Check if the unprocessed bytes and new bytes can fill a block of 16.
// Make this overflow safe in the event that len is Integer.MAX_VALUE.
// Equivalent to: (pos + len < BUF_SIZE)
if (pos + len - BUF_SIZE < 0) {
System.arraycopy(b, off, buffer, pos, len);
pos += len;
return;
}
// Process left-over bytes with new bytes
if (pos > 0) {
final int size = BUF_SIZE - pos;
System.arraycopy(b, off, buffer, pos, size);
process(buffer, 0);
off += size;
}
final int limit = end - BUF_SIZE;
while (off <= limit) {
process(b, off);
off += BUF_SIZE;
}
// Handle left-over bytes
if (off < end) {
pos = end - off;
System.arraycopy(b, off, buffer, 0, pos);
} else {
pos = 0;
}
}