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)
1248
1248
has_downstream_clk_pin_ = has_clk_pin;
1249
1249
}
1250
1250
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
+
1251
1255
bool
1252
1256
Vertex::bfsInQueue (BfsIndex index) const
1253
1257
{
1254
- return (bfs_in_queue_ >> unsigned ( index)) & 1 ;
1258
+ return IN_QUEUE (bfs_in_queue_, index);
1255
1259
}
1256
1260
1257
1261
void
1258
1262
Vertex::setBfsInQueue (BfsIndex index,
1259
1263
bool value)
1260
1264
{
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));
1265
1275
}
1266
1276
1267
1277
// //////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ protected:
368
368
bool has_downstream_clk_pin_:1 ;
369
369
bool crpr_path_pruning_disabled_:1 ;
370
370
bool requireds_pruned_:1 ;
371
- unsigned object_idx_: VertexTable::idx_bits; // 7
371
+ unsigned char object_idx_; // >= VertexTable::idx_bits = 7
372
372
373
373
private:
374
374
friend class Graph ;
You can’t perform that action at this time.
0 commit comments