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 included from AbstractClass

included

Methods inherited from NumberType

value_class

Methods inherited from Type

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

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.



143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/rltk/cg/type.rb', line 143

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.



159
160
161
# File 'lib/rltk/cg/type.rb', line 159

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