make it clear mergeAndStoreByteRegister has no side effects

This commit is contained in:
Xavier Léauté 2014-03-25 16:52:36 -07:00
parent a0c38f574b
commit 178a9aed40
1 changed files with 4 additions and 1 deletions

View File

@ -364,6 +364,7 @@ public abstract class HyperLogLogCollector implements Comparable<HyperLogLogColl
while(otherBuffer.hasRemaining()) { while(otherBuffer.hasRemaining()) {
final int payloadStartPosition = otherBuffer.getShort() - other.getNumHeaderBytes(); final int payloadStartPosition = otherBuffer.getShort() - other.getNumHeaderBytes();
numNonZero += mergeAndStoreByteRegister( numNonZero += mergeAndStoreByteRegister(
storageBuffer,
myPayloadStart + payloadStartPosition, myPayloadStart + payloadStartPosition,
offsetDiff, offsetDiff,
otherBuffer.get() otherBuffer.get()
@ -378,6 +379,7 @@ public abstract class HyperLogLogCollector implements Comparable<HyperLogLogColl
int position = getPayloadBytePosition(); int position = getPayloadBytePosition();
while (otherBuffer.hasRemaining()) { while (otherBuffer.hasRemaining()) {
numNonZero += mergeAndStoreByteRegister( numNonZero += mergeAndStoreByteRegister(
storageBuffer,
position, position,
offsetDiff, offsetDiff,
otherBuffer.get() otherBuffer.get()
@ -604,7 +606,8 @@ public abstract class HyperLogLogCollector implements Comparable<HyperLogLogColl
* *
* @return * @return
*/ */
private int mergeAndStoreByteRegister( private static int mergeAndStoreByteRegister(
final ByteBuffer storageBuffer,
final int position, final int position,
final int offsetDiff, final int offsetDiff,
final byte byteToAdd final byte byteToAdd