Changeset: 0d12ffc96d13 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0d12ffc96d13
Modified Files:
        gdk/gdk_calc_compare.h
Branch: default
Log Message:

For inherited types, use type-expanded version if possible.


diffs (75 lines):

diff --git a/gdk/gdk_calc_compare.h b/gdk/gdk_calc_compare.h
--- a/gdk/gdk_calc_compare.h
+++ b/gdk/gdk_calc_compare.h
@@ -81,6 +81,7 @@ op_typeswitchloop(const void *lft, int t
        case TYPE_bte:
                switch (tp2) {
                case TYPE_bte:
+               btebte:
                        if (nonil)
                                BINARY_3TYPE_FUNC_nonil(bte, bte, TPE, OP);
                        else
@@ -135,6 +136,7 @@ op_typeswitchloop(const void *lft, int t
                                BINARY_3TYPE_FUNC(sht, bte, TPE, OP);
                        break;
                case TYPE_sht:
+               shtsht:
                        if (nonil)
                                BINARY_3TYPE_FUNC_nonil(sht, sht, TPE, OP);
                        else
@@ -195,6 +197,7 @@ op_typeswitchloop(const void *lft, int t
 #if SIZEOF_WRD == SIZEOF_INT
                case TYPE_wrd:
 #endif
+               intint:
                        if (nonil)
                                BINARY_3TYPE_FUNC_nonil(int, int, TPE, OP);
                        else
@@ -255,6 +258,7 @@ op_typeswitchloop(const void *lft, int t
 #if SIZEOF_WRD == SIZEOF_LNG
                case TYPE_wrd:
 #endif
+               lnglng:
                        if (nonil)
                                BINARY_3TYPE_FUNC_nonil(lng, lng, TPE, OP);
                        else
@@ -309,6 +313,7 @@ op_typeswitchloop(const void *lft, int t
                                BINARY_3TYPE_FUNC(flt, lng, TPE, OP);
                        break;
                case TYPE_flt:
+               fltflt:
                        if (nonil)
                                BINARY_3TYPE_FUNC_nonil(flt, flt, TPE, OP);
                        else
@@ -363,6 +368,7 @@ op_typeswitchloop(const void *lft, int t
                                BINARY_3TYPE_FUNC(dbl, flt, TPE, OP);
                        break;
                case TYPE_dbl:
+               dbldbl:
                        if (nonil)
                                BINARY_3TYPE_FUNC_nonil(dbl, dbl, TPE, OP);
                        else
@@ -430,6 +436,23 @@ op_typeswitchloop(const void *lft, int t
                    !BATatoms[tp1].linear ||
                    (atomcmp = BATatoms[tp1].atomCmp) == NULL)
                        goto unsupported;
+               /* a bit of a hack: for inherited types, use
+                * type-expanded version if comparison function is
+                * equal to the inherited-from comparison function,
+                * and yes, we jump right into the middle of a switch,
+                * but that is legal (although not encouraged) C */
+               if (atomcmp == BATatoms[TYPE_bte].atomCmp)
+                       goto btebte;
+               if (atomcmp == BATatoms[TYPE_sht].atomCmp)
+                       goto shtsht;
+               if (atomcmp == BATatoms[TYPE_int].atomCmp)
+                       goto intint;
+               if (atomcmp == BATatoms[TYPE_lng].atomCmp)
+                       goto lnglng;
+               if (atomcmp == BATatoms[TYPE_flt].atomCmp)
+                       goto fltflt;
+               if (atomcmp == BATatoms[TYPE_dbl].atomCmp)
+                       goto dbldbl;
                nil = ATOMnilptr(tp1);
                CANDLOOP(dst, k, TPE_nil, 0, start);
                for (i = start * incr1, j = start * incr2, k = start;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to