class Yadriggy::C::Float32Array
Array of 32bit floating point numbers. In C
, the type of this array is `arrayof(Float32)`.
Public Class Methods
element_type()
click to toggle source
# File lib/yadriggy/c/ffi.rb, line 128 def self.element_type() CType::Float32 end
new(size, ptr=nil)
click to toggle source
@param [Integer] size array size. @param [FFI::MemoryPointer] ptr a memory pointer or nil.
If nil, a new memory block is allocated.
# File lib/yadriggy/c/ffi.rb, line 112 def initialize(size, ptr=nil) if ptr.nil? @array = FFI::MemoryPointer.new(:float, size) else @array = ptr end end
Public Instance Methods
[](index)
click to toggle source
# File lib/yadriggy/c/ffi.rb, line 120 def [](index) @array.get_float32(index * 4) end
[]=(index, value)
click to toggle source
# File lib/yadriggy/c/ffi.rb, line 124 def []=(index, value) @array.put_float32(index * 4, value) end