Commits

Barry Schwartz committed 35ca00c

In the "roots" functions, return optimized float arrays instead of plain ones.

Comments (0)

Files changed (1)

caml2geom_stubs.c

         std::vector<Geom::Coord> roots =                                \
             curve->roots(Double_val(_coord), dim2[Int_val(_dim2)]);     \
         size_t n = roots.size();                                        \
-        _roots = caml_alloc(n, 0);                                      \
+        _roots = caml_alloc(n * Double_wosize, Double_array_tag);       \
         for (int i; i < n; i++)                                         \
-            Store_field(_roots, i, caml_copy_double(roots[i]));         \
+            Store_double_field(_roots, i, roots[i]);                    \
         CAMLreturn(_roots);                                             \
     }                                                                   \
                                                                         \
     std::vector<Geom::Coord> roots =
         path->roots(Double_val(_coord), dim2[Int_val(_dim2)]);
     size_t n = roots.size();
-    _roots = caml_alloc(n, 0);
+    _roots = caml_alloc(n * Double_wosize, Double_array_tag);
     for (int i; i < n; i++)
-        Store_field(_roots, i, caml_copy_double(roots[i]));
+        Store_double_field(_roots, i, roots[i]);
     CAMLreturn(_roots);
 }