]> www.ginac.de Git - cln.git/blob - src/vector/cl_SV_number.cc
Tweak for MacOS X.
[cln.git] / src / vector / cl_SV_number.cc
1 // cl_make_heap_SV_number().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 CL_PROVIDE(cl_SV_number)
7
8 // Specification.
9 #include "cln/SV_number.h"
10
11
12 // Implementation.
13
14 #include "cln/abort.h"
15
16 namespace cln {
17
18 static void cl_svector_number_destructor (cl_heap* pointer)
19 {
20 #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug
21         (*(cl_heap_SV_number*)pointer).~cl_heap_SV();
22 #else
23         (*(cl_heap_SV_number*)pointer).~cl_heap_SV_number();
24 #endif
25 }
26
27 cl_class cl_class_svector_number = {
28         cl_svector_number_destructor,
29         0
30 };
31
32 cl_heap_SV_number* cl_make_heap_SV_number_uninit (uintL len)
33 {
34         var cl_heap_SV_number* hv = (cl_heap_SV_number*) malloc_hook(sizeof(cl_heap_SV_number)+sizeof(cl_number)*len);
35         hv->refcount = 1;
36         hv->type = &cl_class_svector_number;
37         new (&hv->v) cl_SV_inner<cl_number> (len);
38         // Have to fill hv->v[i] (0 <= i < len) yourself.
39         return hv;
40 }
41
42 cl_heap_SV_number* cl_make_heap_SV_number (uintL len)
43 {
44         var cl_heap_SV_number* hv = (cl_heap_SV_number*) malloc_hook(sizeof(cl_heap_SV_number)+sizeof(cl_number)*len);
45         hv->refcount = 1;
46         hv->type = &cl_class_svector_number;
47         new (&hv->v) cl_SV_inner<cl_number> (len);
48         for (var uintL i = 0; i < len; i++)
49                 init1(cl_number, hv->v[i]) (0);
50         return hv;
51 }
52
53 // An empty vector.
54 const cl_SV_number cl_null_SV_number = cl_SV_number((uintL)0);
55
56 }  // namespace cln
57
58 CL_PROVIDE_END(cl_SV_number)