Linked Questions

75 questions linked to/from Bitwise operation and usage
44 votes
5 answers
73k views

I came across the following code numdigits = len(cardNumber) oddeven = numdigits & 1 what exactly is going on here? I'm not sure what the "&" is doing.
locoboy's user avatar
  • 39.1k
-2 votes
2 answers
843 views

I'm writing a memory manager in C and am trying to make sure it's properly aligned (make sure the user space starts on an address divisible by 8, and make sure the whole block is divisible by 8 as ...
0 votes
3 answers
385 views

Can anyone show me how this operation works? Index is number and it can be any number from 0 to 128. I just don't understand how (index & 0x88) can be 0 or not. Any help will be greatly ...
user2313976's user avatar
0 votes
1 answer
424 views

I understand that the bitwise and operator (&) is equivalent to a product of two bit values. When would I use it? I am also keen to understand what num&1 does in the code below: def func(num): ...
-2 votes
1 answer
184 views

In doing a bitwise &, I thought by specifying the digit it would add that digit in the necessary spot, but in python I get the following: >>> 4&2 0 >>> 4&1<<1 0 &...
-6 votes
2 answers
319 views

Possible Duplicate: Bitwise Operation and Usage x is the input. need to put either 0, 1, x, or x̅ : x & 0 = 0 x & 1 = x x | 0 = x x | 1 = 0 x ^ 0 = 1 x ^ 1 =
userz2038240's user avatar
1 vote
0 answers
265 views

I was reading a word count example for Apache beam when I saw this Python code p | beam.io.ReadFromText( 'gs://dataflow-samples/shakespeare/kinglear.txt') In this p is a already defined variable ...
0 votes
3 answers
98 views

I have an object that I need to compare some attributes of and I can't explain what is going on, but the following is the output of my VS code debugger (I added '=' before each output) (0 > 55000 | ...
0 votes
0 answers
118 views

`why 0x35014541 is output of xor eax, ebx? xor does not shows only 1 or 0? **Register** eax = 0xffffffff ebx = 0xcafebabe **Code** xor eax, ebx Output eax = 0x35014541 Expected 1
hstuk's user avatar
  • 1
0 votes
0 answers
105 views

I'm new in Python and I would like to know how to change the least significant bit in Python. I would like to do something like this: mybytes = bytes(16) ## Creating the byte object filled with ...
0 votes
1 answer
70 views

i know the mechanics behind from operator OR, but in this case why the output is 7 ? what is behind? x = int(5) x = x | 3 print(x) Thanks.
Mick's user avatar
  • 77
-1 votes
1 answer
106 views

I found out something interesting in Python. When I input: 99 & 100 Out is 96. What does '&' do with these numbers? Why is the answer '96'? It looks so wierd... Thank you in advance!
-1 votes
2 answers
86 views

I have the following code segment in python if mask & selectors.EVENT_READ: recv_data = sock.recv(1024) if recv_data: data.outb += recv_data else: print(f"...
-7 votes
1 answer
88 views

year=1992 print (year%4==0 and (year%100==0 or year%400==0)) print (year%4==0 & (year%100==0 or year%400==0)) Why two output are not equal?
-3 votes
1 answer
65 views

I have tried to find out about these operations in Python: x|3 x^3 x>>=3 x<<=3 I couldn't find anything. Please can anyone tell me what are these operations are called, so that I can ...

15 30 50 per page
1
2 3 4 5