Changeset: 0dd7b7ee1154 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0dd7b7ee1154
Modified Files:
        gdk/gdk_strimps.c
Branch: string_imprints
Log Message:

Remove unused code


diffs (192 lines):

diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -737,188 +737,3 @@ STRMPcreate(BAT *b, BAT *s)
        TRC_DEBUG(ACCELERATOR, "strimp creation took " LLFMT " usec\n", 
GDKusec()-t0);
        return GDK_SUCCEED;
 }
-
-/* Left over code */
-#if 0
-/* This counts how many unicode codepoints the given string
- * contains.
- */
-static size_t
-STRMP_utf8_strlen(const uint8_t *s)
-{
-       size_t ret = 0;
-       size_t i;
-       int m,n;
-       uint8_t c;
-
-       i = 0;
-       while((c = *(s + i)) != 0) {
-               if (c < 0x80)
-                       i++;
-               else {
-                       for (n = 0, m=0x40; c & m; n++, m >>= 1)
-                               ;
-                       /* n is now the number of 10xxxxxx bytes that should
-                          follow. */
-                       if (n == 0 || n >= 4)
-                               /* TODO: handle invalid utf-8 */
-                               {}
-                       i += n+1;
-               }
-               ret++;
-       }
-
-       return ret;
-}
-
-/* Construct a histogram of pairs of bytes in the input BAT.
- *
- * Return the histogram in hist and the number of non-zero bins in
- * count.
- */
-static gdk_return
-STRMPmakehistogramBP(BAT *b, uint64_t *hist, size_t hist_size, size_t *nbins)
-{
-       lng t0=0;
-       size_t hi;
-       BUN i;
-       BATiter bi;
-       char *ptr, *s;
-       /* uint64_t cur_min = 0; */
-
-       TRC_DEBUG_IF(ACCELERATOR) t0 = GDKusec();
-       assert(b->ttype == TYPE_str);
-
-       for(hi = 0; hi < hist_size; hi++)
-               hist[hi] = 0;
-
-       bi = bat_iterator(b);
-       *nbins = 0;
-       for(i = 0; i < b->batCount; i++) {
-               s = (char *)BUNtvar(bi, i);
-               if (!strNil(s)) {
-                       for(ptr = s; *ptr != 0 && *(ptr + 1) != 0; ptr++) {
-                               if (isIgnored(*(ptr+1))) {
-                                       /* Skip this and the next pair
-                                        * if the next char is ignored.
-                                        */
-                                       ptr++;
-                               }
-                               else if (isIgnored(*ptr)) {
-                                       /* Skip this pair if the current
-                                        * char is ignored. This should
-                                        * only happen at the beginnig
-                                        * of a string.
-                                        */
-                                       ;
-                               }
-                               else {
-                                       hi = pairToIndex(*(ptr), *(ptr+1));
-                                       assert(hi < hist_size);
-                                       if (hist[hi] == 0)
-                                               (*nbins)++;
-                                       hist[hi]++;
-                                       /* if (hist[hi] > cur_min) */
-                                       /*      cur_min = add_to_header(hi, 
hist[hi]); */
-                               }
-                       }
-               }
-       }
-
-       TRC_DEBUG(ACCELERATOR, LLFMT " usec\n", GDKusec() - t0);
-       GDKtracer_flush_buffer();
-       return GDK_SUCCEED;
-}
-
-static bool
-create_header(BAT *b)
-{
-       uint64_t hist[STRIMP_HISTSIZE] = {0};
-       size_t nbins = 0;
-       StrimpHeader *header;
-       if ((header = (StrimpHeader*)GDKmalloc(sizeof(StrimpHeader))) == NULL)
-               return false;
-
-       if(STRMPmakehistogramBP(b, hist, STRIMP_HISTSIZE, &nbins) != 
GDK_SUCCEED) {
-               GDKfree(header);
-               return NULL;
-       }
-
-       make_header(header, hist, STRIMP_HISTSIZE);
-
-       return header;
-}
-
-/* Given a strimp h and a pair p, return the index i for which
- *
- * h[i] == p
- *
- * Returns -1 if p is not in h.
- *
- * TODO: Should this be inlined somehow? (probably yes)
- */
-static int8_t
-lookup_index(BAT *b, uint8_t *pair, uint8_t psize)
-{
-       size_t i,j;
-       size_t idx = 0;
-       Heap strimp = b->tstrimps->strimps;
-       uint64_t desc = (uint64_t)strimp.base[0];
-       uint8_t npairs = NPAIRS(desc);
-       uint8_t *pair_sizes = b->tstrimps->sizes_base;
-       uint8_t *pairs = b->tstrimps->pairs_base;
-
-       for(i = 0; i < npairs; i++) {
-               if (psize == pair_sizes[i]) {
-                       uint8_t *h = pairs + idx;
-                       for (j = 0; j < psize; j++) {
-                               if(pair[j] != h[j])
-                                       break;
-                       }
-                       if (j == psize)
-                               return i;
-               }
-               idx += pair_sizes[i];
-       }
-
-       return -1;
-}
-
-/* Given a BAT return the number of digrams in it. The observation is
- * that the number of digrams is the number of characters - 1:
- *
- * 1 digram starting at character 1
- * 1 digram starting at character 2
- * [...]
- * 1 digram starting at character n - 1
- */
-gdk_return
-STRMPndigrams(BAT *b, size_t *n)
-{
-       // lng t0;
-       BUN i;
-       BATiter bi;
-       char *s;
-       // GDKtracer_set_component_level("ALGO", "DEBUG");
-       // struct canditer ci;
-
-       // t0 = GDKusec();
-       // BATcheck(b, NULL);
-       assert(b->ttype == TYPE_str);
-
-       bi = bat_iterator(b);
-       *n = 0;
-       for (i = 0; i < b->batCount; i++) {
-               s = (char *)BUNtail(bi, i);
-               // *n += STRMP_strlen(s) - 1;
-               *n += strlen(s) - 1;
-               // TRC_DEBUG(ACCELERATOR, "s["LLFMT"]=%s\n", i, s);
-       }
-
-       // TRC_DEBUG(ACCELERATOR, LLFMT "usec\n", GDKusec() - t0);
-       // GDKtracer_flush_buffer();
-
-       return GDK_SUCCEED;
-}
-
-#endif
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to