類別 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