I tried solving this question by reversing the number by using bitwise operation

say for example if the number' binary representation is 00000110 ,what this does is, send 0000011 into the code and the left shift reverse_num 5 times to get 01100000 which obviously is reverse of original,after that I am doing an "&" with this number to original number.if answer is 1 then number is palindrome.Is there some flaw in my logic? If there is ,I think its's in the & part.

```
class Solution {
public:
bool isPalindrome(int x) {
if(x<0)
return false;
int num=x;
int reverse_num=x;
int count=sizeof(x);
num >>= 1;
while(num)
{
reverse_num <<= 1;
reverse_num |= num & 1;
num >>= 1;
count--;
}
reverse_num <<= count;
if(!(reverse_num&&x))
return true;
else return false;
}
};
```