Reputation: 51
I am reading something and I don't understand the meaning of the bit shift that stated below but I think it is basically programming question. I am reading a file and see this
#define PIN_GEN (((uint32_t)1)<<31)
, but I don't quite understand the meaning of (((uint32_t)1)<<31)
. Could somebody tell me what is the meaning of this?
Upvotes: 2
Views: 65
Reputation: 153478
((uint32_t)1)<<31
--> Make constant 1 of type uint32_t
(32-bit unsigned with no padding) then shift left 31 places. Same as
((uint32_t) 2147483648u)
The value is likely used as some sort of bit mask to indicate which bit to set.
Upvotes: 2