File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -1248,20 +1248,30 @@ Vertex::setHasDownstreamClkPin(bool has_clk_pin)
12481248 has_downstream_clk_pin_ = has_clk_pin;
12491249}
12501250
1251+ #define IN_QUEUE (mask, index ) (mask & (1 << unsigned (index)))
1252+ #define SET_IN_QUEUE (mask, index ) ((mask) |= (1 << unsigned (index)))
1253+ #define CLEAR_IN_QUEUE (mask, index ) ((mask) &= ~(1 << unsigned (index)))
1254+
12511255bool
12521256Vertex::bfsInQueue (BfsIndex index) const
12531257{
1254- return (bfs_in_queue_ >> unsigned ( index)) & 1 ;
1258+ return IN_QUEUE (bfs_in_queue_, index);
12551259}
12561260
12571261void
12581262Vertex::setBfsInQueue (BfsIndex index,
12591263 bool value)
12601264{
1261- if (value)
1262- bfs_in_queue_ |= 1 << int (index);
1263- else
1264- bfs_in_queue_ &= ~(1 << int (index));
1265+ unsigned char expected = bfs_in_queue_;
1266+ unsigned char desired;
1267+ do {
1268+ if ((value && IN_QUEUE (expected, index)) || (!value && !IN_QUEUE (expected, index))) {
1269+ return ;
1270+ }
1271+ desired = expected;
1272+ SET_IN_QUEUE (value ? desired : expected, index);
1273+ CLEAR_IN_QUEUE (value ? expected : desired, index);
1274+ } while (!bfs_in_queue_.compare_exchange_weak (expected, desired));
12651275}
12661276
12671277// //////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ protected:
368368 bool has_downstream_clk_pin_:1 ;
369369 bool crpr_path_pruning_disabled_:1 ;
370370 bool requireds_pruned_:1 ;
371- unsigned object_idx_: VertexTable::idx_bits; // 7
371+ unsigned char object_idx_; // >= VertexTable::idx_bits = 7
372372
373373private:
374374 friend class Graph ;
You can’t perform that action at this time.
0 commit comments