susumu.yata
null+****@clear*****
Mon May 20 11:40:43 JST 2013
susumu.yata 2013-05-20 11:40:43 +0900 (Mon, 20 May 2013) New Revision: 3397d8b4a9c1dc5d8164e1835c9430902d1ff72a https://github.com/groonga/grnxx/commit/3397d8b4a9c1dc5d8164e1835c9430902d1ff72a Message: Change the interface of grnxx::Array<bool>. Modified files: lib/grnxx/array.hpp Modified: lib/grnxx/array.hpp (+7 -1) =================================================================== --- lib/grnxx/array.hpp 2013-05-18 16:26:11 +0900 (71a33c6) +++ lib/grnxx/array.hpp 2013-05-20 11:40:43 +0900 (504ef4a) @@ -447,11 +447,13 @@ template <uint64_t PAGE_SIZE_IN_BITS, uint64_t SECONDARY_TABLE_SIZE> class Array<bool, PAGE_SIZE_IN_BITS, TABLE_SIZE, SECONDARY_TABLE_SIZE> { public: + // Internal type to store bits. using Unit = uint8_t; + + private: static constexpr uint64_t UNIT_SIZE = sizeof(Unit) * 8; static constexpr uint64_t PAGE_SIZE = PAGE_SIZE_IN_BITS / UNIT_SIZE; - private: static_assert((PAGE_SIZE % UNIT_SIZE) == 0, "(PAGE_SIZE % UNIT_SIZE) != 0"); using ArrayImpl = Array<Unit, PAGE_SIZE, TABLE_SIZE, SECONDARY_TABLE_SIZE>; @@ -488,6 +490,10 @@ class Array<bool, PAGE_SIZE_IN_BITS, TABLE_SIZE, SECONDARY_TABLE_SIZE> { return ArrayImpl::unlink(storage, storage_node_id); } + // Return the number of values in each unit. + static constexpr uint64_t unit_size() { + return UNIT_SIZE; + } // Return the number of values in each page. static constexpr uint64_t page_size() { return PAGE_SIZE_IN_BITS; -------------- next part -------------- HTML����������������������������... 下载