Commit 98181a84 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2091b] simplified bitfield swap

parent 69fd2225
...@@ -1638,16 +1638,13 @@ RBTree<T>::nodeFission(util::MemorySegment& mem_sgmt, RBNode<T>& node, ...@@ -1638,16 +1638,13 @@ RBTree<T>::nodeFission(util::MemorySegment& mem_sgmt, RBNode<T>& node,
std::swap(node.data_, down_node->data_); std::swap(node.data_, down_node->data_);
// Swap flags bitfields; yes, this is ugly. The right solution is to // Swap flags bitfields; yes, this is ugly (it appears we cannot use
// implement the above note regarding #2054, then we won't have to swap // std::swap for bitfields). The right solution is to implement
// the flags in the first place. // the above note regarding #2054, then we won't have to swap the
struct { // flags in the first place.
uint32_t flags_ : 23; const uint32_t tmp = node.flags_;
uint32_t unused_ : 9;
} tmp;
tmp.flags_ = node.flags_;
node.flags_ = down_node->flags_; node.flags_ = down_node->flags_;
down_node->flags_ = tmp.flags_; down_node->flags_ = tmp;
down_node->down_ = node.getDown(); down_node->down_ = node.getDown();
node.down_ = down_node; node.down_ = down_node;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment