[Groonga-mysql-commit] mroonga/mroonga [master] Use ceil() instead of round()

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Fri Nov 16 16:14:05 JST 2012


Kouhei Sutou	2012-11-16 16:14:05 +0900 (Fri, 16 Nov 2012)

  New Revision: 74637c3162ef2ceca91152d8ef96bf2e22476a35
  https://github.com/mroonga/mroonga/commit/74637c3162ef2ceca91152d8ef96bf2e22476a35

  Log:
    Use ceil() instead of round()
    
    It simplifies the current code.

  Modified files:
    ha_mroonga.cpp

  Modified: ha_mroonga.cpp (+1 -10)
===================================================================
--- ha_mroonga.cpp    2012-11-16 14:47:38 +0900 (433cf8b)
+++ ha_mroonga.cpp    2012-11-16 16:14:05 +0900 (3f11242)
@@ -6122,16 +6122,7 @@ ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min,
     }
     grn_obj_unlink(ctx, index_cursor);
     grn_table_cursor_close(ctx, cursor);
-    ha_rows tmp_row_count = (int)(round((double)table_size * ((double)row_count / (double)cardinality)));
-    if (tmp_row_count < 2) {
-      if (row_count == 1) {
-        row_count = 1;
-      } else {
-        row_count = 2;
-      }
-    } else {
-      row_count = tmp_row_count;
-    }
+    row_count = (int)(ceil((double)table_size * ((double)row_count / (double)cardinality)));
   }
   DBUG_RETURN(row_count);
 }
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-mysql-commit mailing list
アーカイブの一覧に戻る