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.

Parameters:

  • width (Integer)

    Width of new integer type.

  • context (Context) (defaults to: nil)

    Context in which to create the type.

Raises:

  • (RuntimeError)

    Raises an error when width is <= 0.



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:

  • (RuntimeError)

    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