【发布时间】:2016-07-15 19:41:26
【问题描述】:
例如,我有以下 C++ 结构...
struct dleaf_t
{
int contents; // OR of all brushes (not needed?)
short cluster; // cluster this leaf is in
short area : 9; // area this leaf is in
short flags : 7; // flags
short mins[ 3 ]; // for frustum culling
short maxs[ 3 ];
unsigned short firstleafface; // index into leaffaces
unsigned short numleaffaces;
unsigned short firstleafbrush; // index into leafbrushes
unsigned short numleafbrushes;
short leafWaterDataID; // -1 for not in water
//!!! NOTE: for maps of version 19 or lower uncomment this block
/*
CompressedLightCube ambientLighting; // Precaculated light info for entities.
short padding; // padding to 4-byte boundary
*/
};
通常我可以使用 JNA 在 Java 中轻松表示结构,但这种结构使用自定义位数来表示数据类型(如果我没记错的话)。
例如,area 是 9 位的 short,而不是像往常一样的 16 位。 flags 是 7 位的短...等等。
如何定义具有自定义位大小数据类型的 JNA 结构?
【问题讨论】:
标签: java struct structure jna bits