Compartir a través de


ByteBuffer.AlignmentOffset(Int32, Int32) Method

Definition

Returns the memory address, pointing to the byte at the given index, modulus the given unit size.

[Android.Runtime.Register("alignmentOffset", "(II)I", "", ApiSince=33)]
public int AlignmentOffset (int index, int unitSize);
[<Android.Runtime.Register("alignmentOffset", "(II)I", "", ApiSince=33)>]
member this.AlignmentOffset : int * int -> int

Parameters

index
Int32

The index to query for alignment offset, must be non-negative, no upper bounds check is performed

unitSize
Int32

The unit size in bytes, must be a power of 2

Returns

The indexed byte's memory address modulus the unit size

Attributes

Remarks

Returns the memory address, pointing to the byte at the given index, modulus the given unit size.

A return value greater than zero indicates the address of the byte at the index is misaligned for the unit size, and the value's quantity indicates how much the index should be rounded up or down to locate a byte at an aligned address. Otherwise, a value of 0 indicates that the address of the byte at the index is aligned for the unit size.

Added in 9.

Java documentation for java.nio.ByteBuffer.alignmentOffset(int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to