Home
last modified time | relevance | path

Searched refs:unitSize (Results 1 – 7 of 7) sorted by relevance

/libcore/ojluni/src/main/java/java/nio/
DByteBuffer.java2302 public final int alignmentOffset(int index, int unitSize) { in alignmentOffset() argument
2305 if (unitSize < 1 || (unitSize & (unitSize - 1)) != 0) in alignmentOffset()
2306 throw new IllegalArgumentException("Unit size not a power of two: " + unitSize); in alignmentOffset()
2307 if (unitSize > 8 && !isDirect()) in alignmentOffset()
2308 …row new UnsupportedOperationException("Unit size unsupported for non-direct buffers: " + unitSize); in alignmentOffset()
2315 return (int) (elementAddress & (unitSize - 1)); in alignmentOffset()
2378 public final ByteBuffer alignedSlice(int unitSize) { in alignedSlice() argument
2382 int pos_mod = alignmentOffset(pos, unitSize); in alignedSlice()
2383 int lim_mod = alignmentOffset(lim, unitSize); in alignedSlice()
2387 ? pos + (unitSize - pos_mod) in alignedSlice()
DX-Buffer.java.template2251 * (inclusive) up to {@code unitSize} (exclusive), with zero indicating
2260 * int value = alignmentOffset(index, unitSize)</pre></blockquote>
2263 * alignmentOffset(index - value, unitSize) == 0, value &le; index</pre></blockquote>
2266 * alignmentOffset(index + (unitSize - value), unitSize) == 0</pre></blockquote>
2281 * @param unitSize
2302 public final int alignmentOffset(int index, int unitSize) {
2305 if (unitSize < 1 || (unitSize & (unitSize - 1)) != 0)
2306 throw new IllegalArgumentException("Unit size not a power of two: " + unitSize);
2307 if (unitSize > 8 && !isDirect())
2308 …row new UnsupportedOperationException("Unit size unsupported for non-direct buffers: " + unitSize);
[all …]
/libcore/ojluni/src/test/java/nio/Buffer/
DBasicByte.java514 int unitSize = 1 << rnd.nextInt(maxPow2); in testAlign() local
516 int index = rnd.nextInt(unitSize << 1); in testAlign()
517 int value = bb.alignmentOffset(index, unitSize); in testAlign()
519 if (value < 0 || value >= unitSize) { in testAlign()
521 value + " >= " + unitSize); in testAlign()
524 bb.alignmentOffset(index - value, unitSize) != 0) in testAlign()
526 if (bb.alignmentOffset(index + (unitSize - value), in testAlign()
527 unitSize) != 0) in testAlign()
531 seed, index, unitSize, value); in testAlign()
DBasic-X.java.template513 // 1 == 2^0 <= unitSize == 2^k <= bb.capacity()/2
514 int unitSize = 1 << rnd.nextInt(maxPow2);
515 // 0 <= index < 2*unitSize
516 int index = rnd.nextInt(unitSize << 1);
517 int value = bb.alignmentOffset(index, unitSize);
519 if (value < 0 || value >= unitSize) {
521 value + " >= " + unitSize);
524 bb.alignmentOffset(index - value, unitSize) != 0)
526 if (bb.alignmentOffset(index + (unitSize - value),
527 unitSize) != 0)
[all …]
/libcore/ojluni/annotations/flagged_api/java/nio/
DByteBuffer.annotated.java125 public final int alignmentOffset(int index, int unitSize) { throw new RuntimeException("Stub!"); } in alignmentOffset() argument
127 public final java.nio.ByteBuffer alignedSlice(int unitSize) { throw new RuntimeException("Stub!"); } in alignedSlice() argument
/libcore/luni/src/test/java/libcore/java/nio/
DBufferTest.java1479 for (int unitSize = 1; unitSize <= 8; unitSize *= 2) { in alignmentOffsetChecks()
1481 bb.alignmentOffset(-1 - start, unitSize); in alignmentOffsetChecks()
1486 if (unitSize > 2) { in alignmentOffsetChecks()
1488 bb.alignmentOffset(0, unitSize - 1); in alignmentOffsetChecks()
1494 int alignmentAtZero = bb.alignmentOffset(0, unitSize); in alignmentOffsetChecks()
1496 assertEquals((alignmentAtZero + i) % unitSize, bb.alignmentOffset(i, unitSize)); in alignmentOffsetChecks()
/libcore/ojluni/annotations/sdk/nullability/java/nio/
DByteBuffer.annotated.java117 @libcore.util.NonNull public final java.nio.ByteBuffer alignedSlice(int unitSize) { throw new Runti… in alignedSlice() argument