类 Fiddle::CUnionEntity
指向 C 联合体的指针
公共类方法
size(types) 点击切换源代码
返回给定 types
所需的联合体大小。
Fiddle::CUnionEntity.size( [ Fiddle::TYPE_DOUBLE, Fiddle::TYPE_INT, Fiddle::TYPE_CHAR, Fiddle::TYPE_VOIDP ]) #=> 8
# File ext/fiddle/lib/fiddle/struct.rb, line 521 def CUnionEntity.size(types) types.map { |type, count = 1| if type.respond_to?(:entity_class) type.size * count else PackInfo::SIZE_MAP[type] * count end }.max end
公共实例方法
set_ctypes(types) 点击切换源代码
使用给定的 types
计算每个联合体成员的必要偏移量
# File ext/fiddle/lib/fiddle/struct.rb, line 533 def set_ctypes(types) @ctypes = types @offset = Array.new(types.length, 0) @size = self.class.size types end