2014-06-16 18:49:12 +00:00
|
|
|
package org.capnproto;
|
|
|
|
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
|
|
|
|
final class FarPointer {
|
2014-06-16 23:46:33 +00:00
|
|
|
public static int getSegmentId(long ref) {
|
|
|
|
return WirePointer.upper32Bits(ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int positionInSegment(long ref) {
|
|
|
|
return WirePointer.offsetAndKind(ref) >>> 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isDoubleFar(long ref) {
|
|
|
|
return ((WirePointer.offsetAndKind(ref) >>> 2) & 1) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSegmentId(ByteBuffer buffer, int offset, int segmentId) {
|
2014-06-16 18:49:12 +00:00
|
|
|
buffer.putInt(8 * offset + 4, segmentId);
|
|
|
|
}
|
|
|
|
}
|