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

Merge with Oct2014 branch.


diffs (89 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -62,15 +62,12 @@ insert_string_bat(BAT *b, BAT *n, int ap
        unsigned int tiv;       /* tail value-as-int */
 #endif
        var_t v;                /* value */
-       int ntw, btw;           /* shortcuts for {b,n}->T->width */
        size_t off;             /* offset within n's string heap */
 
        assert(b->htype == TYPE_void || b->htype == TYPE_oid);
        if (n->batCount == 0)
                return b;
        ni = bat_iterator(n);
-       btw = b->T->width;
-       ntw = n->T->width;
        hp = NULL;
        tp = NULL;
        if (append && b->htype != TYPE_void) {
@@ -192,16 +189,15 @@ insert_string_bat(BAT *b, BAT *n, int ap
                         * first that the width of b's offset heap can
                         * accommodate all values. */
                        if (b->T->width < SIZEOF_VAR_T &&
-                           ((size_t) 1 << 8 * b->T->width) < (b->T->width <= 2 
? (b->T->vheap->size >> GDK_VARSHIFT) - GDK_VAROFFSET : (b->T->vheap->size >> 
GDK_VARSHIFT))) {
+                           ((size_t) 1 << 8 * b->T->width) <= (b->T->width <= 
2 ? (b->T->vheap->size >> GDK_VARSHIFT) - GDK_VAROFFSET : (b->T->vheap->size >> 
GDK_VARSHIFT))) {
                                /* offsets aren't going to fit, so
                                 * widen offset heap */
                                if (GDKupgradevarheap(b->T, (var_t) 
(b->T->vheap->size >> GDK_VARSHIFT), 0, force) == GDK_FAIL) {
                                        toff = ~(size_t) 0;
                                        goto bunins_failed;
                                }
-                               btw = b->T->width;
                        }
-                       switch (btw) {
+                       switch (b->T->width) {
                        case 1:
                                tt = TYPE_bte;
                                tp = &tbv;
@@ -235,12 +231,12 @@ insert_string_bat(BAT *b, BAT *n, int ap
                        append = 1;
                }
        }
-       if (toff == 0 && ntw == btw && (b->htype == TYPE_void || !append)) {
+       if (toff == 0 && n->T->width == b->T->width && (b->htype == TYPE_void 
|| !append)) {
                /* we don't need to do any translation of offset
                 * values, nor do we need to do any calculations for
                 * the head column, so we can use fast memcpy */
                memcpy(Tloc(b, BUNlast(b)), Tloc(n, BUNfirst(n)),
-                      BATcount(n) * ntw);
+                      BATcount(n) * n->T->width);
                if (b->htype != TYPE_void) {
                        assert(n->htype == b->htype);
                        assert(!append);
@@ -265,7 +261,7 @@ insert_string_bat(BAT *b, BAT *n, int ap
                        if (!append && b->htype)
                                hp = BUNhloc(ni, p);
 
-                       switch (ntw) {
+                       switch (n->T->width) {
                        case 1:
                                v = (var_t) *tbp++ + GDK_VAROFFSET;
                                break;
@@ -284,7 +280,7 @@ insert_string_bat(BAT *b, BAT *n, int ap
                        v = (var_t) ((((size_t) v << GDK_VARSHIFT) + toff) >> 
GDK_VARSHIFT);
                        assert(v >= GDK_VAROFFSET);
                        assert(((size_t) v << GDK_VARSHIFT) < 
b->T->vheap->free);
-                       switch (btw) {
+                       switch (b->T->width) {
                        case 1:
                                assert(v - GDK_VAROFFSET < ((var_t) 1 << 8));
                                tbv = (unsigned char) (v - GDK_VAROFFSET);
@@ -331,15 +327,14 @@ insert_string_bat(BAT *b, BAT *n, int ap
                                        *(oid *) Hloc(b, BUNlast(b)) = *(oid *) 
hp;
                                v = (var_t) (off >> GDK_VARSHIFT);
                                if (b->T->width < SIZEOF_VAR_T &&
-                                   ((size_t) 1 << 8 * b->T->width) < 
(b->T->width <= 2 ? v - GDK_VAROFFSET : v)) {
+                                   ((size_t) 1 << 8 * b->T->width) <= 
(b->T->width <= 2 ? v - GDK_VAROFFSET : v)) {
                                        /* offset isn't going to fit,
                                         * so widen offset heap */
                                        if (GDKupgradevarheap(b->T, v, 0, 
force) == GDK_FAIL) {
                                                goto bunins_failed;
                                        }
-                                       btw = b->T->width;
                                }
-                               switch (btw) {
+                               switch (b->T->width) {
                                case 1:
                                        assert(v - GDK_VAROFFSET < ((var_t) 1 
<< 8));
                                        *(unsigned char *)Tloc(b, BUNlast(b)) = 
(unsigned char) (v - GDK_VAROFFSET);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to