[PATCH] D33516: Add generic __bswap[ds]i2 implementations

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 07:36:44 PDT 2017


dim added a comment.

Hmm, it's a bit weird that `lib/builtins` doesn't have its own `.clang-format` file.  Is this supposed to have LLVM or Google style?  The style across various files seems to be wildly different.

Both the LLVM and Google style reformat the body of the function to the following, which I find very ugly:

  return (
      (((u)&0xff00000000000000ULL) >> 56) |
      (((u)&0x00ff000000000000ULL) >> 40) |
      (((u)&0x0000ff0000000000ULL) >> 24) | (((u)&0x000000ff00000000ULL) >> 8) |
      (((u)&0x00000000ff000000ULL) << 8) | (((u)&0x0000000000ff0000ULL) << 24) |
      (((u)&0x000000000000ff00ULL) << 40) |
      (((u)&0x00000000000000ffULL) << 56));

I am going to ignore clang-format's suggestion here, and just have one `|` expression per line instead.


https://reviews.llvm.org/D33516





More information about the llvm-commits mailing list