bit-manipulation
javascript bitwise operator question
In Javascript when I do this var num = 1; ~ num == -2 why does ~num not equal 0 in binary 1 is stored as 1 ... thus not 1 should be 0[详细]
2023-04-01 07:17 分类:问答Setting individual bits in mongo, to store a bitmask
I want to store some flags into a mongo db. For now I have the following: > db.test.save({a:0x1}) > db.test.save({a:0x3})[详细]
2023-04-01 05:43 分类:问答What is a good way to iterate a number through all the possible values of a mask?
Given a bitmask where the set bits describe where another number can be one or zero and the unset bits must be zero in开发者_运维问答 that number. What\'s a good way to iterate through all its possibl[详细]
2023-04-01 05:07 分类:问答Count the number of bits set using only bitwise operations [duplicate]
This question already has answers here: 开发者_开发技巧 Closed 11 years ago. Possible Duplicate: Best algorithm to count the number of set bits in a 32-bit integer?[详细]
2023-04-01 02:16 分类:问答Simple XOR ruby 1.9.2
Apparently this used to wor开发者_StackOverflow中文版k on ruby 1.8.7 but unfortunately not on 1.9.2[详细]
2023-04-01 00:36 分类:问答C Using bitwise operators tell if binary number has all evens set to 0 [duplicate]
This question already has answers here: Closed 11 years ago. Possible Duplicate: Find if every even bit is set to 0 using bitwise operators[详细]
2023-03-31 19:56 分类:问答Find if every even bit is set to 0 using bitwise operators
I have a 32 bit int I can only access it 8 bits at a time. I need to find out if every even bit is set 开发者_JAVA百科to 0 and return 0 if its true and 1 otherwise.[详细]
2023-03-31 15:01 分类:问答Python Bitshift 32 Bit Constraint [duplicate]
This question already has an answer here: Closed 开发者_Python百科11 years ago. Possible Duplicate:[详细]
2023-03-31 10:43 分类:问答How to use bitwise operators to return a 0 or 1
My function takes in a 32 bit int and I need to return a 0 or 1 if that number has a 1 in any even position. I cant use any conditional statements I also can only access 8 bits at a time.[详细]
2023-03-31 08:54 分类:问答Strange behavior of bitwise NOT (~)
How do I explain the following behavior? #include<iostream> using namespace std; int main(){ unsigned char a = 8;[详细]
2023-03-31 01:36 分类:问答