模块 RubyVM::RJIT::CType::Immediate

常量

TYPE_MAP

公共类方法

find(size, signed) 单击切换源代码
# File ruby_vm/rjit/c_type.rb, line 49
def self.find(size, signed)
  fiddle_type = TYPE_MAP.fetch(size)
  fiddle_type = -fiddle_type unless signed
  new(fiddle_type)
end
new(fiddle_type) 单击切换源代码

@param fiddle_type [Integer]

# File ruby_vm/rjit/c_type.rb, line 31
def self.new(fiddle_type)
  name = Fiddle.constants.find do |const|
    const.start_with?('TYPE_') && Fiddle.const_get(const) == fiddle_type.abs
  end&.name
  name = name.delete_prefix('TYPE_')
  if fiddle_type.negative?
    name.prepend('U')
  end
  CPointer.with_class_name('Immediate', name, cache: true) do
    CPointer::Immediate.define(fiddle_type)
  end
end
parse(ctype) 单击切换源代码

@param type [String]

# File ruby_vm/rjit/c_type.rb, line 45
def self.parse(ctype)
  new(Fiddle::Importer.parse_ctype(ctype))
end