Hi, when I execute the following why the printf function show something wrong:
#include<limits.h>
#include<stdio.h>
#include <iostream> // librería para uso de cout
using namespace std;
class Rotation {
unsigned __int64 K;
short int desplazar;
public:
Rotation (unsigned __int64, short int);
unsigned __int64 RotaionalLeftShift()
{
unsigned __int64 top_bits = 0;
top_bits = K >> (sizeof K * CHAR_BIT) - desplazar;
K <<= desplazar;
K |= top_bits;
return K;
}
};
Rotation::Rotation (unsigned __int64 a, short int b) {
K = a;
desplazar = b;
}
int main () {
unsigned __int64 nuevo1 = 0, nuevo2 = 0 ;
Rotation rect (0xafffffffffffffff,4);
Rotation rectb (0xadeaffffffffffff,4);
nuevo1 = rect.RotaionalLeftShift();
nuevo2 = rectb.RotaionalLeftShift();
printf("%I64d\n", nuevo1);
printf("%I64d\n", nuevo2);
return 0;
}