Update of /cvsroot/monetdb/MonetDB5/src/modules/mal/crackers
In directory
sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5237/src/modules/mal/crackers
Modified Files:
crackers_core_unordered.mx
Log Message:
handle edge cases with empty pieces especially at the beggining of the cracker
bat
Index: crackers_core_unordered.mx
===================================================================
RCS file:
/cvsroot/monetdb/MonetDB5/src/modules/mal/crackers/crackers_core_unordered.mx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- crackers_core_unordered.mx 14 Jan 2008 22:24:15 -0000 1.4
+++ crackers_core_unordered.mx 23 Jan 2008 13:09:05 -0000 1.5
@@ -180,16 +180,24 @@
}
if (lt == ft) {
- if (@[EMAIL PROTECTED](lt, &mval,@[EMAIL PROTECTED]))
- *pos = (oid)(lt - t0) - (oid)1; /*works for empty left
piece also*/
+ if (@[EMAIL PROTECTED](lt, &mval,@[EMAIL PROTECTED])){
+ if (lt==t0)
+ *pos = BUNfirst(b);
+ else
+ *pos = (lt - t0) - 1; /*works for empty left
piece also*/
+ }
else{
- *pos = (oid)(lt - t0);
+ *pos = lt - t0;
if (*pos==last) /*empty right piece*/
- *pos = *pos + (oid)1;
+ *pos = *pos + 1;
}
}
- else
- *pos = (oid)(lt - t0);
+ else{
+ if (lt > t0)
+ *pos = lt - t0;
+ else
+ *pos = BUNfirst(b);
+ }
return MAL_SUCCEED;
}
@@ -223,7 +231,7 @@
else if (@[EMAIL PROTECTED](tmax, &low,@[EMAIL PROTECTED]))
/*result is one bun*/
*posl = *posh = tmax-t0;
else{
- *posl = tmax-t0 - (oid)1;
+ *posl = (tmax-t0) - 1;
*posh = tmax-t0;
}
return MAL_SUCCEED;
@@ -246,7 +254,7 @@
else if (@[EMAIL PROTECTED](lt, &low,@[EMAIL PROTECTED]))
*posl = lt-t0;
else
- *posl = lt-t0 + (oid)1;
+ *posl = (lt-t0) + 1;
*posh = tmax-t0;
return MAL_SUCCEED;
}
@@ -274,7 +282,7 @@
return MAL_SUCCEED;
}
if (tmax == lt){ /*then middle piece is empty*/
- *posl = lt - t0 + (oid)1;
+ *posl = (lt - t0) + 1;
*posh = tmax - t0;
return MAL_SUCCEED;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins