python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Check if N(large) bits are set
I want to check if any of the 1024 bits (128 bytes) are set. If all are clear, then I want to do something. Is it possible to do this quickly, i.e one instruction or do I have to loop through my bitma...
beans
Votes: 0
Answers: 2
How to swap n bits from 2 numbers?
So currently (I don't know if the width is relevant) I have 2 128bit integers that I want to swap shift bits as shift is a part of a structure:
unsigned char shift : 7;
So I get the relevant bits lik...
AnArrayOfFunctions
Votes: 0
Answers: 2
Convert a numpy bool array to int
I have a numpy array (dtype bool) representing an array of bits. For example, the array np.array([True, False, False], dtype=bool) represents the number 4 (indeed, bin(4) == 0b100).
I would like to co...
Riccardo Bucco
Votes: 0
Answers: 2
How could I calculate the inverse of this bitwise formula?
I'm working on practicing my algorithms and getting into some bitwise stuff which I'm not too proficient with yet.
So I have this function:
def fn1(a):
return (a >> 1) ^ a
But I need to rev...
SkyPharaoh
Votes: 0
Answers: 1