Class: LLVM::IntType

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

Instance Attribute Summary

Attributes inherited from Type

#kind

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

Instance Method Details

#all_onesObject



223
224
225
# File 'lib/llvm/core/type.rb', line 223

def all_ones
  from_ptr(C.const_all_ones(self))
end

#from_i(int, options = {}) ⇒ Object



242
243
244
245
246
247
248
249
250
# File 'lib/llvm/core/type.rb', line 242

def from_i(int, options = {})
  signed = get_sign_option(options)

  return parse(int.to_s, 0) if width > 64 || int.is_a?(String)

  val = from_ptr(C.const_int(self, int, signed ? 1 : 0))
  unpoisoned = val.to_i(signed) == int
  unpoisoned ? val : poison
end

#from_ptr(ptr) ⇒ Object



263
264
265
# File 'lib/llvm/core/type.rb', line 263

def from_ptr(ptr)
  ConstantInt.from_ptr(ptr)
end

#parse(str, radix = 10) ⇒ Object

parse string using const_int_of_string_and_size alternative implementation parsing with ruby: from_i(str.to_i(radix))



280
281
282
# File 'lib/llvm/core/type.rb', line 280

def parse(str, radix = 10)
  const_int_of_string_and_size(str, radix)
end

#typeObject



284
285
286
# File 'lib/llvm/core/type.rb', line 284

def type
  self
end

#widthObject



227
228
229
# File 'lib/llvm/core/type.rb', line 227

def width
  C.get_int_type_width(self)
end