diff src/ov-float.cc @ 10670:654fbde5dceb

make cellfun's fast scalar collection mechanism public
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 28 May 2010 12:28:06 +0200
parents 2a8b1db1e2ca
children 0de5cc44e690
line wrap: on
line diff
--- a/src/ov-float.cc	Thu May 27 20:12:51 2010 -0700
+++ b/src/ov-float.cc	Fri May 28 12:28:06 2010 +0200
@@ -319,3 +319,22 @@
       return octave_base_value::map (umap);
     }
 }
+
+bool
+octave_float_scalar::fast_elem_insert_self (void *where, builtin_type_t btyp) const
+{
+
+  // Support inline real->complex conversion.
+  if (btyp == btyp_float)
+    {
+      *(reinterpret_cast<float *>(where)) = scalar;
+      return true;
+    }
+  else if (btyp == btyp_float_complex)
+    {
+      *(reinterpret_cast<FloatComplex *>(where)) = scalar;
+      return true;
+    }
+  else
+    return false;
+}