diff src/ov-base.h @ 9790:a5035bc7fbfb

rewrite dispatch part & slightly improve min,max,cummin,cummax
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 09 Nov 2009 13:09:49 +0100
parents 0df32e0b2074
children f80c566bc751
line wrap: on
line diff
--- a/src/ov-base.h	Mon Nov 09 10:21:31 2009 +0100
+++ b/src/ov-base.h	Mon Nov 09 13:09:49 2009 +0100
@@ -69,12 +69,28 @@
   btyp_uint16,
   btyp_uint32,
   btyp_uint64,
+  btyp_bool,
   btyp_char,
-  btyp_bool,
   btyp_unknown,
   btyp_num_types = btyp_unknown
 };
 
+inline bool btyp_isnumeric (builtin_type_t btyp)
+{ return btyp <= btyp_uint64; }
+
+// Compute a numeric type for a possibly mixed-type operation, using these rules:
+// bool -> double
+// single + double -> single
+// real + complex -> complex
+// integer + real -> integer
+// uint + uint -> uint (the bigger one)
+// sint + sint -> sint (the bigger one)
+//
+// failing otherwise.
+
+extern OCTINTERP_API
+builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y);
+
 template <class T>
 struct class_to_btyp
 {