简体   繁体   English

整数和位数组之间的按位运算

[英]Bitwise operations between an integer and an array of bits

Suppose I have a c++ array of bits, ones and zeros, and I want to have it bitwise XORed with an integer number, and get the result as an integer. 假设我有一个c ++的位,一个和零数组,我想将它与一个整数按位进行XOR运算,并以整数形式获得结果。 What is the fastest way to do so? 最快的方法是什么?

假设您的意思是std::bitset 假设它适合无unsigned long result = your_bits.to_ulong() ^ your_int

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM