c++ - Bit manipulation issues with signed and unsigned ints, XNOR -


I am implementing parallel radix sort, I want to calculate the bit value on a specific bit index to calculate I am trying to scan two offsets for offset addresses for radix, one for bit value of '0' and one for '1' bit.

I am trying to make a flag that I want to work with it, a specific bit value or not, I pass a boolean flag in my colonel which states that I '0' or ' I want to work with 1 'bits, the flag is called the doOnes if the flag is true, and the bit value is 1, then I would justify another flag useBit But I want to know how to move it to my kernel. If the flag is true and the bit value is 0, then I should have the useBit flag false.

I can confirm that I'm getting the proper bit value. My issue is computing below useVal

  // This kernel bool doOnes = Signals the flags given in false; // This is an unsigned int bit value symbol that I get within my kernel unsigned int bitVal1 = 1; Unsigned int bitVal0 = 0; Printf ("& gt; bit veal 1:% u bitvel 0:% u \ n", bitwall 1, bitwall 0); // How do I determine whether I want to use data on bits index or not use int useVal1 = ~ (bitVal1 ^ doOnes); // Use XNOR = ~ (val1 ^ val2) int VAL0 = ~ (bitVal0 ^ doOnes); Printf ("& gt; bit VAL1X:% i bitval0x:% i \ n", use VAL1, useVal0);   

The production has been produced here

  & gt; Bitwell 1: 1 bitville 0: 0> Bitval1x: -2 bitval0x: -1   

How do I add the flag doOnes and how do bit value to determine if I want to use it Am I

Edit:

What do I need here?

  doOnes | BitVal | UseBit = XNOR (doOnes, bitVal) ------------------------------ True | 0 | Wrong fact. 1 | True lie 0 | True lie 1 | False    

Acre operator ~ reverses all the bits , You want united operator ! which reverse the Boolean values

 ! (BitVal1 ^ doOnes)   



Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -