Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are "1LL" and "-1LL" in C++ [duplicate]

Tags:

c++

Can anyone please let me know what exactly 1LL and -1LL are? Here is the line in which they have been used:

#define All_In(G) (((G) == 64) ? (W64)(-1LL) : ((1LL << (G))-1LL))
like image 461
user2517676 Avatar asked Oct 17 '25 13:10

user2517676


1 Answers

The purpose of the macro appears to be to produce an integer with the G least significant bits set. All_In(1)==1, All_In(2)==3, All_In(3)==7, and so on.

In psuedo-code, the macro is saying this:

if G == 64
    produce -1
else
    produce (1 bitshifted left by G) - 1

bit shifting, if you don't know what that is

like image 175
Benjamin Lindley Avatar answered Oct 19 '25 04:10

Benjamin Lindley