[Groonga-commit] groonga/grnxx at 94af608 [master] Fix bugs of grnxx::Array<bool>.

Back to archive index

susumu.yata null+****@clear*****
Tue May 28 16:35:46 JST 2013


susumu.yata	2013-05-28 16:35:46 +0900 (Tue, 28 May 2013)

  New Revision: 94af60862d6cddc7aecf1381d07f98b7e50df6a4
  https://github.com/groonga/grnxx/commit/94af60862d6cddc7aecf1381d07f98b7e50df6a4

  Message:
    Fix bugs of grnxx::Array<bool>.

  Modified files:
    lib/grnxx/array.hpp

  Modified: lib/grnxx/array.hpp (+4 -2)
===================================================================
--- lib/grnxx/array.hpp    2013-05-28 16:22:24 +0900 (6068680)
+++ lib/grnxx/array.hpp    2013-05-28 16:35:46 +0900 (757467b)
@@ -476,7 +476,8 @@ class Array<bool, PAGE_SIZE_IN_BITS, TABLE_SIZE, SECONDARY_TABLE_SIZE> {
   static constexpr uint64_t UNIT_SIZE = sizeof(Unit) * 8;
   static constexpr uint64_t PAGE_SIZE = PAGE_SIZE_IN_BITS / UNIT_SIZE;
 
-  static_assert((PAGE_SIZE % UNIT_SIZE) == 0, "(PAGE_SIZE % UNIT_SIZE) != 0");
+  static_assert((PAGE_SIZE_IN_BITS % UNIT_SIZE) == 0,
+                "(PAGE_SIZE_IN_BITS % UNIT_SIZE) != 0");
   using ArrayImpl = Array<Unit, PAGE_SIZE, TABLE_SIZE, SECONDARY_TABLE_SIZE>;
 
  public:
@@ -499,7 +500,8 @@ class Array<bool, PAGE_SIZE_IN_BITS, TABLE_SIZE, SECONDARY_TABLE_SIZE> {
   // Create an array with the default value.
   bool create(Storage *storage, uint32_t storage_node_id,
               ValueArg default_value) {
-    return impl_.create(storage, storage_node_id, default_value ? 0xFF : 0x00);
+    return impl_.create(storage, storage_node_id,
+                        default_value ? ~Unit(0) : Unit(0));
   }
 
   // Open an array.
-------------- next part --------------
HTML����������������������������...
Download 



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