mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Minor improvements related to VanillaChronicleMap.alignAddr()
This commit is contained in:
@@ -233,15 +233,15 @@ public class VanillaChronicleMap<K, V, R>
|
||||
return valueSize;
|
||||
}
|
||||
|
||||
void alignReadPosition(Bytes entry) {
|
||||
public void alignReadPosition(Bytes entry) {
|
||||
long positionAddr = entry.address(entry.readPosition());
|
||||
long skip = alignAddr(positionAddr, alignment) - positionAddr;
|
||||
if (skip > 0)
|
||||
entry.readSkip(skip);
|
||||
}
|
||||
|
||||
public static long alignAddr(long addr, int alignment) {
|
||||
return (addr + alignment - 1) & ~(alignment - 1);
|
||||
public static long alignAddr(long addr, long alignment) {
|
||||
return (addr + alignment - 1) & ~(alignment - 1L);
|
||||
}
|
||||
|
||||
private ChainingInterface q() {
|
||||
|
||||
@@ -73,11 +73,7 @@ public abstract class MapEntryStages<K, V> extends HashEntryStages<K>
|
||||
Bytes segmentBytes = s.segmentBytesForRead();
|
||||
segmentBytes.readPosition(valueSizeOffset);
|
||||
valueSize = mh.m().readValueSize(segmentBytes);
|
||||
long currentPosition = segmentBytes.readPosition();
|
||||
long currentAddr = segmentBytes.address(currentPosition);
|
||||
long skip = alignAddr(currentAddr, mh.m().alignment) - currentAddr;
|
||||
if (skip > 0)
|
||||
segmentBytes.readSkip(skip);
|
||||
mh.m().alignReadPosition(segmentBytes);
|
||||
valueOffset = segmentBytes.readPosition();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user