How to know if cpu supports unaligned memory accesses ?

Alan Bateman Alan.Bateman at
Sun Apr 18 07:10:43 UTC 2021

On 17/04/2021 19:02, Laurent Bourgès wrote:
> Hi,
> In the Marlin renderer & in other Unsafe use cases (pixel tile processing)
> for java2d pipelines, I do use putInt()/putLong() primitives even if the
> address is not aligned (to 4 or 8 bytes) to get faster processing of byte
> buffer or arrays...
> Is it possible in java (jdk internals) to query cpu capabilities like
> endianness, unaligned support ?
Since Marlin is in the JDK and using Unsafe already then can't it just 
using the isBigEndian and unalignedAccess methods? The Buffer 
implementation and a few places do the same.


More information about the core-libs-dev mailing list