yakra / DataProcessing

Data Processing Scripts and Programs for Travel Mapping Project
0 stars 0 forks source link

bitwise XOR compound assignment #266

Closed yakra closed 3 months ago

yakra commented 4 months ago

https://github.com/yakra/DataProcessing/blob/f86fadc9479d6ad91852c6c38d35f641b70ec6ef/siteupdate/cplusplus/classes/GraphGeneration/HighwayGraph.cpp#L194

https://github.com/yakra/DataProcessing/blob/f86fadc9479d6ad91852c6c38d35f641b70ec6ef/siteupdate/cplusplus/classes/GraphGeneration/HGEdge.cpp#L141

foo &= ~(bar) -> foo ^= bar; Probably won't improve much. The compiler may even optimize it away. But it's The Right Thing To Do!

Low priority though:

yakra commented 3 months ago

Nope. foo ^ 1 toggles foo rather than simply clearing it. For these uses cases, it would have to be guaranteed that the target bit is already 1. Don't know offhand if that's the case, and I'm not going to delve that deep into the code to find out. As this is already low priority for the reasons in the OP, simply closing this.