Skip to content

Instantly share code, notes, and snippets.

@Deco
Created February 12, 2015 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deco/850e3e8f05cb0495588a to your computer and use it in GitHub Desktop.
Save Deco/850e3e8f05cb0495588a to your computer and use it in GitHub Desktop.
{.experimental.}
import sequtils, unittest as unittest
type arrayUnchecked {.unchecked.} [T] = array[0..0, T]
type memory[T] = ptr arrayUnchecked[T]
let intCount = 10
let floatCount = 20
let memoryBlockPtr = alloc0(intCount*sizeof(int) + floatCount*sizeof(float32))
let intArray = cast[memory[int]](memoryBlockPtr)
let floatArray = cast[memory[float32]]( ??? ) # help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment