1 << 63
will be computed in int
arithmetic, and your int
is probably 32 bit.
Remedy this by promoting one of the arguments: 1ULL << 63
will do it.
ULL
means the expression will be at least 64 bits.
More Related Contents:
- C – is any use of unsigned int just terrible coding practice? [closed]
- Comparison operation on unsigned and signed integers
- Arithmetic bit-shift on a signed integer
- Are the shift operators () arithmetic or logical in C?
- Is unsigned integer subtraction defined behavior?
- Right shifting negative numbers in C
- What does the C standard say about bitshifting more bits than the width of type?
- Bitwise operators and “endianness”
- Why is a negative int greater than unsigned int? [duplicate]
- Difference between signed / unsigned char [duplicate]
- How to printf “unsigned long” in C?
- Difference between unsigned and unsigned int in C
- Difference between size_t and unsigned int?
- Why doesn’t C have unsigned floats?
- Unsigned hexadecimal constant in C?
- What does the statement if (counter & (1
- c get nth byte of integer
- Unsigned values in C
- C left shift on 64 bits fail
- What happens when I assign a negative value to an unsigned int? [duplicate]
- what is the unsigned datatype?
- warning: left shift count >= width of type
- C Unsigned int providing a negative value?
- C reverse bits in unsigned integer
- Why is int rather than unsigned int used for C and C++ for loops?
- Why use the Bitwise-Shift operator for values in a C enum definition?
- Why does combining two shifts of a uint8_t produce a different result?
- Declaring 64-bit variables in C
- OpenMP time and clock() give two different results
- Increasing camera capture resolution in OpenCV