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.
假设我有一个由位、一和零组成的 c++ 数组,并且我希望将它与一个整数进行按位异或,并将结果作为整数得到。最快的方法是什么?
假设您的意思是 astd::bitset 并假设它适合 unsigned long ,那么unsigned long result = your_bits.to_ulong() ^ your_int;
std::bitset
unsigned long result = your_bits.to_ulong() ^ your_int