susumu.yata
null+****@clear*****
Fri Aug 8 13:01:48 JST 2014
susumu.yata 2014-08-08 13:01:48 +0900 (Fri, 08 Aug 2014) New Revision: dfec8e1fd51fb7a5cc0e9edc6d331c85264f64ea https://github.com/groonga/grnxx/commit/dfec8e1fd51fb7a5cc0e9edc6d331c85264f64ea Message: Disable BoolReference. Modified files: include/grnxx/array.hpp lib/grnxx/column.cpp lib/grnxx/expression.cpp lib/grnxx/expression2.cpp lib/grnxx/sorter.cpp Modified: include/grnxx/array.hpp (+48 -48) =================================================================== --- include/grnxx/array.hpp 2014-08-08 12:47:54 +0900 (464e1b8) +++ include/grnxx/array.hpp 2014-08-08 13:01:48 +0900 (193a630) @@ -174,45 +174,45 @@ class Array { std::vector<T> values_; }; -class BoolReference { - public: - BoolReference(uint64_t *block, uint64_t mask) - : block_(block), - mask_(mask) {} - - operator Bool() const { - return (*block_ & mask_) != 0; - } +//class BoolReference { +// public: +// BoolReference(uint64_t *block, uint64_t mask) +// : block_(block), +// mask_(mask) {} + +// operator Bool() const { +// return (*block_ & mask_) != 0; +// } - BoolReference operator=(Bool rhs) { - if (rhs) { - *block_ |= mask_; - } else { - *block_ &= ~mask_; - } - return *this; - } - BoolReference operator=(BoolReference rhs) { - if (rhs) { - *block_ |= mask_; - } else { - *block_ &= ~mask_; - } - return *this; - } +// BoolReference operator=(Bool rhs) { +// if (rhs) { +// *block_ |= mask_; +// } else { +// *block_ &= ~mask_; +// } +// return *this; +// } +// BoolReference operator=(BoolReference rhs) { +// if (rhs) { +// *block_ |= mask_; +// } else { +// *block_ &= ~mask_; +// } +// return *this; +// } - private: - uint64_t *block_; - uint64_t mask_; -}; +// private: +// uint64_t *block_; +// uint64_t mask_; +//}; -inline bool operator==(const BoolReference &lhs, Bool rhs) { - return static_cast<Bool>(lhs) == rhs; -} +//inline bool operator==(const BoolReference &lhs, Bool rhs) { +// return static_cast<Bool>(lhs) == rhs; +//} -inline bool operator!=(const BoolReference &lhs, Bool rhs) { - return static_cast<Bool>(lhs) != rhs; -} +//inline bool operator!=(const BoolReference &lhs, Bool rhs) { +// return static_cast<Bool>(lhs) != rhs; +//} // ArrayRef<Bool> is specialized because a bit does not have its own unique // address and thus a pointer type for Bool is not available. @@ -250,10 +250,10 @@ class ArrayRef<Bool> { } } - BoolReference operator[](Int i) { - i += static_cast<Int>(offset_); - return BoolReference(&blocks_[i / 64], uint64_t(1) << (i % 64)); - } +// BoolReference operator[](Int i) { +// i += static_cast<Int>(offset_); +// return BoolReference(&blocks_[i / 64], uint64_t(1) << (i % 64)); +// } Bool operator[](Int i) const { i += static_cast<Int>(offset_); return (blocks_[i / 64] & (uint64_t(1) << (i % 64))) != 0; @@ -313,23 +313,23 @@ class Array<Bool> { } } - BoolReference operator[](Int i) { - return BoolReference(&blocks_[i / 64], uint64_t(1) << (i % 64)); - } +// BoolReference operator[](Int i) { +// return BoolReference(&blocks_[i / 64], uint64_t(1) << (i % 64)); +// } Bool operator[](Int i) const { return (blocks_[i / 64] & (uint64_t(1) << (i % 64))) != 0; } - BoolReference front() { - return BoolReference(&blocks_[0], 1); - } +// BoolReference front() { +// return BoolReference(&blocks_[0], 1); +// } Bool front() const { return (blocks_[0] & 1) != 0; } - BoolReference back() { - return operator[](size_ - 1); - } +// BoolReference back() { +// return operator[](size_ - 1); +// } Bool back() const { return operator[](size_ - 1); } Modified: lib/grnxx/column.cpp (+3 -3) =================================================================== --- lib/grnxx/column.cpp 2014-08-08 12:47:54 +0900 (08f29c6) +++ lib/grnxx/column.cpp 2014-08-08 13:01:48 +0900 (0ce7ee2) @@ -148,7 +148,7 @@ bool ColumnImpl<T>::set(Error *error, Int row_id, const Datum &datum) { // Note that a Bool object does not have its own address. T value; datum.force(&value); - values_[row_id] = value; + values_.set(row_id, value); return true; } @@ -192,13 +192,13 @@ bool ColumnImpl<T>::set_default_value(Error *error, Int row_id) { return false; } } - values_[row_id] = TypeTraits<T>::default_value(); + values_.set(row_id, TypeTraits<T>::default_value()); return true; } template <typename T> void ColumnImpl<T>::unset(Int row_id) { - values_[row_id] = TypeTraits<T>::default_value(); + values_.set(row_id, TypeTraits<T>::default_value()); } template <typename T> Modified: lib/grnxx/expression.cpp (+5 -5) =================================================================== --- lib/grnxx/expression.cpp 2014-08-08 12:47:54 +0900 (a3320aa) +++ lib/grnxx/expression.cpp 2014-08-08 13:01:48 +0900 (9814f07) @@ -254,7 +254,7 @@ class ColumnNode : public Node<T> { return false; } for (Int i = 0; i < record_set.size(); ++i) { - this->values_[i] = column_->get(record_set.get_row_id(i)); + this->values_.set(i, column_->get(record_set.get_row_id(i))); } return true; } @@ -513,7 +513,7 @@ bool BinaryNode<Op>::evaluate(Error *error, const RecordSubset &record_set) { return false; } for (Int i = 0; i < record_set.size(); ++i) { - this->values_[i] = operator_(lhs_->get(i), rhs_->get(i)); + this->values_.set(i, operator_(lhs_->get(i), rhs_->get(i))); } return true; } @@ -572,7 +572,7 @@ bool LogicalAndNode::evaluate(Error *error, const RecordSubset &record_set) { } Int j = 0; for (Int i = 0; i < record_set.size(); ++i) { - this->values_[i] = lhs_->get(i) ? rhs_->get(j++) : false; + this->values_.set(i, lhs_->get(i) ? rhs_->get(j++) : false); } return true; } @@ -726,7 +726,7 @@ bool LogicalOrNode::evaluate(Error *error, const RecordSubset &record_set) { } Int j = 0; for (Int i = 0; i < record_set.size(); ++i) { - this->values_[i] = lhs_->get(i) ? true : rhs_->get(j++); + this->values_.set(i, lhs_->get(i) ? true : rhs_->get(j++)); } return true; } @@ -867,7 +867,7 @@ bool Expression::evaluate_block(Error *error, return false; } for (Int i = 0; i < record_set.size(); ++i) { - (*results)[i] = node->get(i); + results->set(i, node->get(i)); } return true; } Modified: lib/grnxx/expression2.cpp (+4 -4) =================================================================== --- lib/grnxx/expression2.cpp 2014-08-08 12:47:54 +0900 (b9dbdb8) +++ lib/grnxx/expression2.cpp 2014-08-08 13:01:48 +0900 (79967f4) @@ -226,7 +226,7 @@ bool DatumNode<Bool>::evaluate(Error *error, ArrayRef<Bool> *results) { // TODO: Fill results per 64 bits. for (Int i = 0; i < records.size(); ++i) { - (*results)[i] = datum_; + results->set(i, datum_); } return true; } @@ -435,7 +435,7 @@ bool ColumnNode<Bool>::evaluate(Error *error, const RecordSubset &records, ArrayRef<Bool> *results) { for (Int i = 0; i < records.size(); ++i) { - (*results)[i] = column_->get(records.get_row_id(i)); + results->set(i, column_->get(records.get_row_id(i))); } return true; } @@ -614,7 +614,7 @@ bool LogicalNotNode::evaluate(Error *error, // TODO: Should be processed per 64 bits. // Check the 64-bit boundary and do it! for (Int i = 0; i < results->size(); ++i) { - (*results)[i] = !(*results)[i]; + results->set(i, !results->get(i)); } return true; } @@ -662,7 +662,7 @@ bool BitwiseNotNode::evaluate(Error *error, // TODO: Should be processed per 64 bits. // Check the 64-bit boundary and do it! for (Int i = 0; i < results->size(); ++i) { - (*results)[i] = !(*results)[i]; + results->set(i, !results->get(i)); } return true; } Modified: lib/grnxx/sorter.cpp (+1 -1) =================================================================== --- lib/grnxx/sorter.cpp 2014-08-08 12:47:54 +0900 (6b6435e) +++ lib/grnxx/sorter.cpp 2014-08-08 13:01:48 +0900 (5043ae6) @@ -390,7 +390,7 @@ bool BoolNode<T>::sort(Error *error, RecordSubset records, } else { // Note that values_[left] will not be used again. --right; - values_[left] = values_[right]; + values_.set(left, values_[right]); records.swap(left, right); } } -------------- next part -------------- HTML����������������������������...Download