[flang-commits] [flang] [Flang] Shift the data from lower to higher order bits in the big endian environment (PR #73670)

via flang-commits flang-commits at lists.llvm.org
Thu Dec 14 09:01:33 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 3d422a98595f0617e7a0b687fe9fd9f21cc25deb 3d02fb7b7b85fbe0d4cc6f12c12842c428974878 -- flang/include/flang/Common/uint128.h flang/runtime/edit-input.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/include/flang/Common/uint128.h b/flang/include/flang/Common/uint128.h
index d366db3e06..c66dc4f303 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/flang/include/flang/Common/uint128.h
@@ -24,9 +24,11 @@
 #include <type_traits>
 
 #if FLANG_LITTLE_ENDIAN
-#define SWAP(a,i,b,j) a{i},b{j}
+#define SWAP(a, i, b, j) \
+  a{i}, b { j }
 #elif FLANG_BIG_ENDIAN
-#define SWAP(a,i,b,j) b{j},a{i}
+#define SWAP(a, i, b, j) \
+  b{j}, a { i }
 #else
 #error host endianness is not known
 #endif
@@ -43,13 +45,13 @@ public:
   constexpr Int128(unsigned long long n) : low_{n} {}
   constexpr Int128(int n)
       : SWAP(low_, static_cast<std::uint64_t>(n), high_,
-             -static_cast<std::uint64_t>(n < 0)) {}
+            -static_cast<std::uint64_t>(n < 0)) {}
   constexpr Int128(long n)
       : SWAP(low_, static_cast<std::uint64_t>(n), high_,
-             -static_cast<std::uint64_t>(n < 0)) {}
+            -static_cast<std::uint64_t>(n < 0)) {}
   constexpr Int128(long long n)
       : SWAP(low_, static_cast<std::uint64_t>(n), high_,
-             -static_cast<std::uint64_t>(n < 0)) {}
+            -static_cast<std::uint64_t>(n < 0)) {}
   constexpr Int128(const Int128 &) = default;
   constexpr Int128(Int128 &&) = default;
   constexpr Int128 &operator=(const Int128 &) = default;
@@ -255,7 +257,7 @@ public:
 
 private:
   constexpr Int128(std::uint64_t hi, std::uint64_t lo)
-      : SWAP(low_,lo,high_,hi) {}
+      : SWAP(low_, lo, high_, hi) {}
   constexpr int LeadingZeroes() const {
     if (high_ == 0) {
       return 64 + LeadingZeroBitCount(low_);
@@ -264,7 +266,7 @@ private:
     }
   }
   static constexpr std::uint64_t topBit{std::uint64_t{1} << 63};
-  std::uint64_t SWAP(low_,0,high_,0);
+  std::uint64_t SWAP(low_, 0, high_, 0);
 };
 
 using UnsignedInt128 = Int128<false>;

``````````

</details>


https://github.com/llvm/llvm-project/pull/73670


More information about the flang-commits mailing list