Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はオープン ソース プロジェクトからこのコードを取得しましたが、この演算子が何を意味するのか疑問に思っていました。この演算子 |= は何ですか? 次のコードで使用されます。
uint32_t a = VALUE1 | VALUE2; a |= VALUE1;
何か案が ?
|=GCC 固有の演算子ではありません。標準の C++ 複合代入演算子です。a |= bとほぼ同等ですa = a | b。ここ|で、 はビットごとの OR 演算子です。ただし|=、優先順位は=(非常に低い優先順位) です。
|=
a |= b
a = a | b
|
=