intel/psst

Bitwise & vs logical && operator usage

Closed this issue · 2 comments

I'm not 100% sure, but I think the & operator could be replaced with && allowing short circuiting of the 2nd operator if the first operand is false. cppcheck throws the warning:

src/logger.c:783:24: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
  if (configpv.verbose & !configpv.super_verbose)
                       ^
src/logger.c:820:23: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
 if (configpv.verbose & !configpv.super_verbose)

fixed.

fixed. closing