Class: LLVM::RealType

Inherits:
Type
  • Object
show all
Defined in:
lib/llvm/core/type.rb

Instance Attribute Summary

Attributes inherited from Type

#kind

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#===, #aggregate?, #align, array, double, #dump, #element_type, float, from_ptr, function, integer, label, #literal_struct?, named, #null, #null_pointer, opaque_struct, #opaque_struct?, #packed_struct?, #pointer, pointer, #poison, ptr, #size, struct, #to_s, #undef, vector, void, x86_amx, x86_mmx

Methods included from PointerIdentity

#==, #eql?, #hash, #to_ptr

Class Method Details

.fits(values) ⇒ Object

given an array of values, return the type that will fit all of them currently only works for floats and doubles



292
293
294
# File 'lib/llvm/core/type.rb', line 292

def self.fits(values)
  values.detect { |v| v.type.to_s == 'double' } ? double : float
end

Instance Method Details

#from_f(value) ⇒ Object



296
297
298
# File 'lib/llvm/core/type.rb', line 296

def from_f(value)
  ConstantReal.from_ptr(C.const_real(self, value))
end

#parse(str) ⇒ Object



300
301
302
# File 'lib/llvm/core/type.rb', line 300

def parse(str)
  ConstantReal.from_ptr(C.const_real_of_string(self, str))
end

#typeObject



304
305
306
# File 'lib/llvm/core/type.rb', line 304

def type
  self
end