Class: Hornetseye::Malloc

Inherits:
Object show all
Defined in:
lib/multiarray/malloc.rb

Overview

Malloc is extended with a few methods

See Also:

Instance Method Summary collapse

Instance Method Details

#load(typecode) ⇒ Node

Read typed value

Parameters:

  • typecode (Class)

    Load typed value from memory.

Returns:

  • (Node)

    Value from memory.



30
31
32
# File 'lib/multiarray/malloc.rb', line 30

def load( typecode )
  read( typecode.storage_size ).unpack( typecode.directive )
end

#save(value) ⇒ Node

Write typed value to memory

Parameters:

  • value (Node)

    Value to write to memory.

Returns:

  • (Node)

    Returns value.



39
40
41
42
# File 'lib/multiarray/malloc.rb', line 39

def save( value )
  write value.values.pack( value.typecode.directive )
  value
end