Changeset: 90e57013eab3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/90e57013eab3
Modified Files:
        geom/monetdb5/geom_atoms.c
Branch: default
Log Message:

Fix old merge.


diffs (53 lines):

diff --git a/geom/monetdb5/geom_atoms.c b/geom/monetdb5/geom_atoms.c
--- a/geom/monetdb5/geom_atoms.c
+++ b/geom/monetdb5/geom_atoms.c
@@ -96,7 +96,15 @@ wkbHASH(const void *W)
        BUN h = 0;
 
        for (i = 0; i < (w->len - 1); i += 2) {
-               BUN a = (unsigned char) w->data[i], b = (unsigned char) 
w->data[i + 1];
+               BUN a = ((unsigned char *) w->data)[i];
+               BUN b = ((unsigned char *) w->data)[i + 1];
+#if '\377' < 0                                 /* char is signed? */
+               /* maybe sign extend */
+               if (a & 0x80)
+                       a |= ~(BUN)0x7f;
+               if (b & 0x80)
+                       b |= ~(BUN)0x7f;
+#endif
                h = (h << 3) ^ (h >> 11) ^ (h >> 17) ^ (b << 8) ^ a;
        }
        return h;
@@ -456,8 +464,8 @@ BUN
 mbrHASH(const void *ATOM)
 {
        const mbr *atom = ATOM;
-       return (BUN) (mix_int(atom->xmin) ^ mix_int(atom->ymin) ^
-                             mix_int(atom->xmax) ^ mix_int(atom->ymax));
+       return ATOMhash(TYPE_flt, &atom->xmin) ^ ATOMhash(TYPE_flt, 
&atom->ymin) ^
+               ATOMhash(TYPE_flt, &atom->xmax) ^ ATOMhash(TYPE_flt, 
&atom->ymax);
 }
 
 const void *
@@ -1229,7 +1237,15 @@ wkbaHASH(const void *WARRAY)
        for (j = 0; j < wArray->itemsNum; j++) {
                wkb *w = wArray->data[j];
                for (i = 0; i < (w->len - 1); i += 2) {
-                       int a = *(w->data + i), b = *(w->data + i + 1);
+                       BUN a = ((unsigned char *) w->data)[i];
+                       BUN b = ((unsigned char *) w->data)[i + 1];
+#if '\377' < 0                                 /* char is signed? */
+                       /* maybe sign extend */
+                       if (a & 0x80)
+                               a |= ~(BUN)0x7f;
+                       if (b & 0x80)
+                               b |= ~(BUN)0x7f;
+#endif
                        h = (h << 3) ^ (h >> 11) ^ (h >> 17) ^ (b << 8) ^ a;
                }
        }
@@ -1460,4 +1476,3 @@ wkbInteriorRings(wkba **geomArray, wkb *
 
        return MAL_SUCCEED;
 }
-
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to