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



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/llvm/core/type.rb', line 231

def from_i(int, options = {})
  signed = case options
  when true, false
    options
  when Hash
    options.fetch(:signed, true)
  else
    raise ArgumentError
  end
  # return poison if !fits_width?(int, width, signed)

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

#from_ptr(ptr) ⇒ Object



258
259
260
# File 'lib/llvm/core/type.rb', line 258

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

#parse(str, radix = 10) ⇒ Object



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

def parse(str, radix = 10)
  # from_ptr(C.const_int_of_string(self, str, radix))
  from_i(str.to_i(radix))
end

#typeObject



267
268
269
# File 'lib/llvm/core/type.rb', line 267

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