[PATCH] D70452: [scudo][standalone] Minor optimization & improvements

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 09:19:51 PST 2019


hctim added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/combined.h:167
     initThreadMaybe();
-    ZeroContents = ZeroContents || Options.ZeroContents;
+    ZeroContents |= !!Options.ZeroContents;
 
----------------
cryptoad wrote:
> hctim wrote:
> > `!!`?
> `Options.ZeroContents` is technically not a boolean, and I really want to have a boolean when using a bitwise or (since the logical or adds a long condition jump).
> Hence the double logical not.
Maybe `static_cast<bool>(Options.ZeroContents)`? Looks more clear to me IMO, and compiles down to the same thing: https://godbolt.org/z/SrbU2p


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70452/new/

https://reviews.llvm.org/D70452





More information about the llvm-commits mailing list