From 716d34a1fce81ab1f6be61a3773a401ec2b1b0bb Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Mon, 28 Nov 2011 16:51:38 -0800 Subject: [PATCH] BGQ - comments in the _check_is_pow_of_2 function. --- src/srun/opt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/srun/opt.c b/src/srun/opt.c index cd54040372e..f10abbbef54 100644 --- a/src/srun/opt.c +++ b/src/srun/opt.c @@ -1551,7 +1551,11 @@ static void _load_multi(int *argc, char **argv) #if defined HAVE_BG && !defined HAVE_BG_L_P static bool _check_is_pow_of_2(int32_t n) { - return ((n!=0) && (n&(n-1))==0); + /* Bitwise ANDing a power of 2 number like 16 with its + * negative (-16) gives itself back. Only integers which are power of + * 2 behave like that. + */ + return ((n!=0) && (n&(-n))==n); } #endif -- GitLab