susumu.yata
null+****@clear*****
Tue Dec 4 11:24:13 JST 2012
susumu.yata 2012-12-04 11:24:13 +0900 (Tue, 04 Dec 2012) New Revision: a7328a9a9f2ed63129e7e2764976f4d1ed19a028 https://github.com/groonga/grnxx/commit/a7328a9a9f2ed63129e7e2764976f4d1ed19a028 Log: Add BlobVectorMediumValueHeader. Modified files: lib/alpha/blob_vector.hpp Modified: lib/alpha/blob_vector.hpp (+27 -0) =================================================================== --- lib/alpha/blob_vector.hpp 2012-12-03 17:40:38 +0900 (e4c7109) +++ lib/alpha/blob_vector.hpp 2012-12-04 11:24:13 +0900 (a7f8dd0) @@ -93,6 +93,33 @@ const uint8_t BLOB_VECTOR_TYPE_MASK = 0x30; StringBuilder &operator<<(StringBuilder &builder, BlobVectorType type); +class BlobVectorMediumValueHeader { + public: + uint64_t value_id() const { + return dwords_[0] | (static_cast<uint64_t>(bytes_[4]) << 32); + } + uint64_t capacity() const { + return static_cast<uint64_t>(words_[3]) + << BLOB_VECTOR_MEDIUM_VALUE_UNIT_SIZE_BITS; + } + + void set_value_id(uint64_t value) { + dwords_[0] = static_cast<uint32_t>(value); + bytes_[4] = static_cast<uint8_t>(value >> 32); + } + void set_capacity(uint64_t value) { + words_[3] = static_cast<uint16_t>( + value >> BLOB_VECTOR_MEDIUM_VALUE_UNIT_SIZE_BITS); + } + + private: + union { + uint8_t bytes_[8]; + uint16_t words_[4]; + uint32_t dwords_[2]; + }; +}; + class BlobVectorLargeValueHeader { public: uint64_t length() const { -------------- next part -------------- HTML����������������������������... ダウンロード