Just a quick one - getting unexpected result for bitwise AND
My code:
Code:
Primitive<uint64_t> full = 0xBBBBBBBBCCCCCCCC;
Primitive<uint64_t> first = 0x0000000000000000;
first = (full & 0xFFFFFFFE00000000);
std::cout << "FIRST: " << first << std::endl;
Result I am getting:
FIRST: 13527612313275727872
Which is 0x12C5F92C33333333 .
I was expecting 0xBBBBBBBA00000000 .
UPDATE.
Looks like the problem is with initialising 'full'.
For this code:
Code:
Primitive<uint64_t> full = 0xBBBBBBBBCCCCCCCCULL;
unsigned long long f = 0xBBBBBBBBCCCCCCCCULL;
std::cout << "f: " << f << std::endl;
std::cout << "full: " << full << std::endl;
I also get the same result:
f: 13527612321006669004
full: 13527612321006669004
UPDATE 2.
Was a problem with std::cout - was printing numbers as negative for some reason.
Problem solved now.