Little fix after the last commit (mostly a git fail)
[eigenmath-fx.git] / vectorize.cpp
blob3b16773147257cf636a4ac52d8403118f9c8d9e8
1 #include "stdafx.h"
3 //-----------------------------------------------------------------------------
4 //
5 // Encapsulate stack values in a vector
6 //
7 // Input: n Number of values on stack
8 //
9 // tos-n Start of value
11 // Output: Vector on stack
13 //-----------------------------------------------------------------------------
15 #include "defs.h"
17 void
18 vectorize(int n)
20 int i;
22 save();
24 p1 = alloc_tensor(n);
26 p1->u.tensor->ndim = 1;
27 p1->u.tensor->dim[0] = n;
29 for (i = 0; i < n; i++)
30 p1->u.tensor->elem[i] = stack[tos - n + i];
32 tos -= n;
34 push(p1);
36 restore();