Changeset: 9eb10ce1c011 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9eb10ce1c011
Modified Files:
        gdk/gdk_bat.c
Branch: default
Log Message:

Use memcpy instead of inline loop.


diffs (49 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -928,41 +928,15 @@ BATcopy(BAT *b, int ht, int tt, int writ
                        }
                } else {
                        /* case (4): optimized for simple array copy */
-                       int tpe = ATOMstorage(ht | tt);
                        BUN p = BUNfirst(b);
-                       char *cur = (ht ? Hloc(b, p) : Tloc(b, p));
-                       char *d = (ht ? Hloc(bn, 0) : Tloc(bn, 0));
 
                        bn->H->heap.free = bn->T->heap.free = 0;
-                       if (ht)
+                       if (ht) {
                                bn->H->heap.free = bunstocopy * Hsize(bn);
-                       else
+                               memcpy(Hloc(bn, 0), Hloc(b, p), 
bn->H->heap.free);
+                       } else {
                                bn->T->heap.free = bunstocopy * Tsize(bn);
-
-                       if (tpe == TYPE_bte) {
-                               bte *src = (bte *) cur, *dst = (bte *) d;
-
-                               while (bunstocopy--) {
-                                       *dst++ = *src++;
-                               }
-                       } else if (tpe == TYPE_sht) {
-                               sht *src = (sht *) cur, *dst = (sht *) d;
-
-                               while (bunstocopy--) {
-                                       *dst++ = *src++;
-                               }
-                       } else if ((tpe == TYPE_int) || (tpe == TYPE_flt)) {
-                               int *src = (int *) cur, *dst = (int *) d;
-
-                               while (bunstocopy--) {
-                                       *dst++ = *src++;
-                               }
-                       } else {
-                               lng *src = (lng *) cur, *dst = (lng *) d;
-
-                               while (bunstocopy--) {
-                                       *dst++ = *src++;
-                               }
+                               memcpy(Tloc(bn, 0), Tloc(b, p), 
bn->T->heap.free);
                        }
                }
                /* copy all properties (size+other) from the source bat */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to