Class: RLTK::CG::IntType

Inherits:
BasicIntType show all
Defined in:
lib/rltk/cg/type.rb

Overview

An integer of an arbitrary width.

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Instance Method Summary collapse

Methods inherited from BasicIntType

#width

Methods inherited from NumberType

value_class

Methods inherited from Type

#allignment, #context, #dump, from_ptr, #hash, #kind, #size, #to_s

Methods included from BindingClass

#==

Constructor Details

#initialize(width, context = nil) ⇒ IntType

Returns a new instance of IntType.

Raises:

  • Raises an error when width is <= 0.

Parameters:

  • Width of new integer type.

  • (defaults to: nil)

    Context in which to create the type.



158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/rltk/cg/type.rb', line 158

def initialize(width, context = nil)
  if width > 0
    @ptr =
    if context
      Bindings.get_int_type_in_context(width, check_type(context, Context, 'context'))
    else
      Bidnings.get_int_type(width)
    end
  else
    raise 'The width parameter must be greater then 0.'
  end
end

Instance Method Details

#value_classObject

Raises:

  • This function has no meaning in this class.



174
175
176
# File 'lib/rltk/cg/type.rb', line 174

def value_class
  raise 'The RLKT::CG::IntType class has no value class.'
end