c# - ushort a, ushort b from ( ushort )( a | b ) to a with constant b -



c# - ushort a, ushort b from ( ushort )( a | b ) to a with constant b -

i working info b , in more detail described a. atleast how understand it. farther links basic bitwise operations appreciated. objects looking @ have b 0x8000. need find out c.

i have:

ushort ushort b

a 2-5

b = 0x8000 ushort c = (ushort)( | b )

can , if yes how can come c a?

i tried ( & b ) leads me b not a. realy stuck although know should easy if possible if understand operations.

basically, it's c , not b.

ushort a2 = (ushort) (c & ~b);

but because a 2-5 , smaller 0x8000. when a , b start overlap in bits you're stranded.

c# bit-manipulation bitwise-operators

Comments

Popular posts from this blog

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -