class RLTK::CG::ConstantArray
A constant array value.
Public Class Methods
new(element_type, size_or_values, &block)
click to toggle source
Create a new constant array value.
@example Using array of values:
ConstantArray.new(Int32Type, [Int32.new(0), Int32.new(1)])
@example Using size:
ConstantArray.new(Int32Type, 2) { |i| Int32.new(i) }
@yieldparam index [Integer] Index of the value in the array.
@param [Type] element_type Type
of values in this aggregate. @param [Array<Value>, Integer] size_or_values Number of values or array of values. @param [Proc] block Block evaluated if size is specified.
# File lib/rltk/cg/value.rb, line 416 def initialize(element_type, size_or_values, &block) vals_ptr = make_ptr_to_elements(size_or_values, &block) element_type = check_cg_type(element_type, Type, 'element_type') @ptr = Bindings.const_array(element_type, vals_ptr, vals_ptr.size / vals_ptr.type_size) end
Public Instance Methods
size()
click to toggle source
# File lib/rltk/cg/value.rb, line 422 def size self.type.size end
Also aliased as: length