How to input int64_t / uint64_t constants?

后端 未结 3 1029
滥情空心
滥情空心 2020-12-11 02:24

What I\'m trying to do is to define a constant equal to 2^30 (I may change it to something like 2^34, so I prefer to have a room larger than 32 bits for it).

Why the

3条回答
  •  一生所求
    2020-12-11 02:59

    The syntax you are looking for is:

    const uint64_t test = 1ULL << 30;
    

    The post-fix ULL is used for unsigned integer literals that are at least 64-bits wide.

提交回复
热议问题