Module: NDAV::FFI::Pointer::ToNDAV

Defined in:
lib/ndav/ffi.rb

Instance Method Summary collapse

Instance Method Details

#to_ndav(shape:, format: , lifetime: self) ⇒ Object



71
72
73
74
75
# File 'lib/ndav/ffi.rb', line 71

def to_ndav(shape:, format: TYPE_SIZE_TO_FORMAT[type_size], lifetime: self, **)
  byte_size = shape.reduce(ITEM_SIZES[format], :*)
  ptr = ::Fiddle::Pointer.new(address, byte_size)
  ::NDAV.new(ptr, shape:, format:, lifetime:, **)
end