Byte Order Macros

Byte Order Macros — A portable way to read big-endian integers.

Synopsis


#include <jclass/types.h>


#define     UINT16_NATIVE                   (val)
#define     INT16_NATIVE                    (val)
#define     UINT32_NATIVE                   (val)
#define     INT32_NATIVE                    (val)

Description

Java uses big-endian byte ordering exclusively. libjclass always converts everything to native byte order so you might not need these macros. However, if you need to interprete an unknown attribute these macros will come in handy.

Details

UINT16_NATIVE()

#define     UINT16_NATIVE(val)

Converts an unsigned 16-bit big-endian integer to the native byte order.

val :An unsigned 16-bit big-endian integer.

INT16_NATIVE()

#define     INT16_NATIVE(val)

Converts a signed 16-bit big-endian integer to the native byte order.

val :A signed 16-bit big-endian integer.

UINT32_NATIVE()

#define     UINT32_NATIVE(val)

Converts an unsigned 32-bit big-endian integer to the native byte order.

val :An unsigned 32-bit big-endian integer.

INT32_NATIVE()

#define     INT32_NATIVE(val)

Converts a signed 32-bit big-endian integer to the native byte order.

val :A signed 32-bit big-endian integer.