• Create Account

### #ActualOlof Hedman

Posted 16 October 2012 - 06:31 AM

why? I assume you also do something else then, besides the copying of every second bit?

If you need to do it bit by bit, I don't think you have any choice but to check it bit by bit.

My code copies all of them from x at the same time, not caring what they are, and conserve all of the other bits from y

Edit: this if you also need to copy zeros

y = (y&0xAAAAAAAAAAAAAAAALL) | (x&0x5555555555555555LL);

### #4Olof Hedman

Posted 16 October 2012 - 06:31 AM

why? I assume you also do something else then, besides the copying of every second bit?

If you need to do it bit by bit, I don't think you have any choice but to check it bit by bit.

My code copies all of them from x at the same time, not caring what they are, and conserve all of the other bits from y

Edit: this if you also need to copy zeros

y = (y&0xAAAAAAAAAAAAAAAALL) | x&0x5555555555555555LL;

### #3Olof Hedman

Posted 16 October 2012 - 06:31 AM

why? I assume you also do something else then, besides the copying of every second bit?

If you need to do it bit by bit, I don't think you have any choice but to check it bit by bit.

My code copies all of them from x at the same time, not caring what they are, and conserve all of the other bits from y

Edit: this if you also need to copy zeros

so this:
y = (y&0xAAAAAAAAAAAAAAAALL) | x&0x5555555555555555LL;

### #2Olof Hedman

Posted 16 October 2012 - 06:30 AM

why? I assume you also do something else then, besides the copying of every second bit?

If you need to do it bit by bit, I don't think you have any choice but to check it bit by bit.

My code copies all of them from x at the same time, not caring what they are, and conserve all of the other bits from y

Edit: ehm, no it doesn't, forgot you have to clear them in y too

so this:
y = (y&0xAAAAAAAAAAAAAAAALL) | x&0x5555555555555555LL;

### #1Olof Hedman

Posted 16 October 2012 - 06:25 AM

why? I assume you also do something else then, besides the copying of every second bit?

If you need to do it bit by bit, I don't think you have any choice but to check it bit by bit.

My code copies all of them from x at the same time, not caring what they are, and conserve all of the other bits from y

PARTNERS