Skip to content

Instantly share code, notes, and snippets.

Created February 15, 2015 08:25
What would you like to do?
import memory
type MatD*[ElementT] = tuple
elementCount: uint32
dimensionCount: uint16
data: memory[byte]
template matD(dimensions: varargs[float64]; elementT: typedesc): expr =
let dimensionCount = len(dimensions)
let elementCount = foldl(dimensions, a*b)
echo "aaaahhh", a, ", ", b
let headerMemSize = sizeof(MatD[elementT])
let elementMemSize = sizeof(elementT)*elementCount
let dimensionSizeListMemSize = sizeof(byte)*dimensionCount
let dataMemSize = elementMemSize+dimensionSizeListMemSize
let totalMemSize = headerMemSize+dataMemSize
let mem = memalloc() # not yet finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment