module RubyVM::RJIT::CType::Immediate

Constants

TYPE_MAP

Public Class Methods

find(size, signed) click to toggle source
# 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) click to toggle source

@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&.to_s
  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) click to toggle source

@param type [String]

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