Added 64 bit width to sizes and handle it in memory implementations.
This commit is contained in:
@@ -4,8 +4,10 @@ public final class Sizes {
|
||||
public static final int SIZE_8 = 8;
|
||||
public static final int SIZE_16 = 16;
|
||||
public static final int SIZE_32 = 32;
|
||||
public static final int SIZE_64 = 64;
|
||||
|
||||
public static final int SIZE_8_LOG2 = 0;
|
||||
public static final int SIZE_16_LOG2 = 1;
|
||||
public static final int SIZE_32_LOG2 = 2;
|
||||
public static final int SIZE_64_LOG2 = 3;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ public class ByteBufferMemory implements PhysicalMemory {
|
||||
return data.getShort(offset);
|
||||
case Sizes.SIZE_32_LOG2:
|
||||
return data.getInt(offset);
|
||||
case Sizes.SIZE_64_LOG2:
|
||||
// TODO Widen API to support 64 bit values and addresses.
|
||||
return (int) data.getLong(offset);
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@@ -60,6 +60,10 @@ public final class UnsafeMemory implements PhysicalMemory {
|
||||
case Sizes.SIZE_32_LOG2:
|
||||
assert (offset & 0b11) == 0;
|
||||
return UNSAFE.getInt(address + offset);
|
||||
case Sizes.SIZE_64_LOG2:
|
||||
assert (offset & 0b111) == 0;
|
||||
// TODO Widen API to support 64 bit values and addresses.
|
||||
return (int) UNSAFE.getLong(address + offset);
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@@ -80,6 +84,10 @@ public final class UnsafeMemory implements PhysicalMemory {
|
||||
assert (offset & 0b11) == 0;
|
||||
UNSAFE.putInt(address + offset, value);
|
||||
break;
|
||||
case Sizes.SIZE_64_LOG2:
|
||||
assert (offset & 0b111) == 0;
|
||||
UNSAFE.putLong(address + offset, value);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user