com.sun.jna.Native.getStructureAlignment()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(241)

本文整理了Java中com.sun.jna.Native.getStructureAlignment()方法的一些代码示例,展示了Native.getStructureAlignment()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Native.getStructureAlignment()方法的具体详情如下:
包路径:com.sun.jna.Native
类名称:Native
方法名:getStructureAlignment

Native.getStructureAlignment介绍

[英]Return the preferred structure alignment for the given native interface.
[中]返回给定本机接口的首选结构对齐方式。

代码示例

代码示例来源:origin: net.java.dev.jna/jna

/** Change the alignment of this structure.  Re-allocates memory if
 * necessary.  If alignment is {@link #ALIGN_DEFAULT}, the default
 * alignment for the defining class will be used.
 * @param alignType desired alignment type
 */
protected void setAlignType(int alignType) {
  this.alignType = alignType;
  if (alignType == ALIGN_DEFAULT) {
    alignType = Native.getStructureAlignment(getClass());
    if (alignType == ALIGN_DEFAULT) {
      if (Platform.isWindows())
        alignType = ALIGN_MSVC;
      else
        alignType = ALIGN_GNUC;
    }
  }
  this.actualAlignType = alignType;
  layoutChanged();
}

代码示例来源:origin: com.sun.jna/jna

/** Change the alignment of this structure.  Re-allocates memory if 
 * necessary.  If alignment is {@link #ALIGN_DEFAULT}, the default 
 * alignment for the defining class will be used. 
 */
protected void setAlignType(int alignType) {
  if (alignType == ALIGN_DEFAULT) {
    Class declaring = getClass().getDeclaringClass();
    if (declaring != null) 
      alignType = Native.getStructureAlignment(declaring);
    if (alignType == ALIGN_DEFAULT) {
      if (Platform.isWindows())
        alignType = ALIGN_MSVC;
      else
        alignType = ALIGN_GNUC;
    }
  }
  this.alignType = alignType;
  this.size = CALCULATE_SIZE;
  this.memory = null;
}

代码示例来源:origin: org.elasticsearch/jna

/** Change the alignment of this structure.  Re-allocates memory if
 * necessary.  If alignment is {@link #ALIGN_DEFAULT}, the default
 * alignment for the defining class will be used.
 * @param alignType desired alignment type
 */
protected void setAlignType(int alignType) {
  this.alignType = alignType;
  if (alignType == ALIGN_DEFAULT) {
    alignType = Native.getStructureAlignment(getClass());
    if (alignType == ALIGN_DEFAULT) {
      if (Platform.isWindows())
        alignType = ALIGN_MSVC;
      else
        alignType = ALIGN_GNUC;
    }
  }
  this.actualAlignType = alignType;
  layoutChanged();
}

相关文章

Native类方法