[Groonga-commit] groonga/groonga at c2f0659 [master] Use bit operation for flags

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 5 17:43:17 JST 2016


Kouhei Sutou	2016-02-05 17:43:17 +0900 (Fri, 05 Feb 2016)

  New Revision: c2f0659f332a8b5bb2bb1ad3361ecc9fbc5f79ce
  https://github.com/groonga/groonga/commit/c2f0659f332a8b5bb2bb1ad3361ecc9fbc5f79ce

  Message:
    Use bit operation for flags

  Modified files:
    lib/pat.c
    lib/proc.c

  Modified: lib/pat.c (+1 -1)
===================================================================
--- lib/pat.c    2016-02-05 17:43:05 +0900 (f929023)
+++ lib/pat.c    2016-02-05 17:43:17 +0900 (ec49cce)
@@ -1320,7 +1320,7 @@ calc_edit_distance_by_offset(grn_ctx *ctx,
         b = DIST(x, y - 1) + 1;
         c = DIST(x - 1, y - 1) + 1;
         DIST(x, y) = ((a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c));
-        if (flags == GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION
+        if (flags & GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION
             && x > 1 && y > 1
             && cx == cy
             && memcmp(px, py - cy, cx) == 0

  Modified: lib/proc.c (+3 -3)
===================================================================
--- lib/proc.c    2016-02-05 17:43:05 +0900 (a1d1627)
+++ lib/proc.c    2016-02-05 17:43:17 +0900 (3243200)
@@ -4341,7 +4341,7 @@ calc_edit_distance(grn_ctx *ctx, char *sx, char *ex, char *sy, char *ey, int fla
           uint32_t b = DIST(x, y - 1) + 1;
           uint32_t c = DIST(x - 1, y - 1) + 1;
           DIST(x, y) = ((a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c));
-          if (flags == GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION
+          if (flags & GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION
               && x > 1 && y > 1 && cx == cy
               && memcmp(px, py - cy, cx) == 0
               && memcmp(px - cx, py, cx) == 0) {
@@ -4367,7 +4367,7 @@ func_edit_distance(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_
   grn_obj *obj;
   if (nargs >= N_REQUIRED_ARGS && nargs <= MAX_ARGS) {
     if (nargs == MAX_ARGS && GRN_BOOL_VALUE(args[2])) {
-      flags = GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION;
+      flags |= GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION;
     }
     d = calc_edit_distance(ctx, GRN_TEXT_VALUE(args[0]), GRN_BULK_CURR(args[0]),
                            GRN_TEXT_VALUE(args[1]), GRN_BULK_CURR(args[1]), flags);
@@ -7044,7 +7044,7 @@ selector_fuzzy_search(grn_ctx *ctx, grn_obj *table, grn_obj *index,
   }
   if (nargs == 7) {
     if (GRN_BOOL_VALUE(args[6])) {
-      flags = GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION;
+      flags |= GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION;
     }
   }
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index