[PATCH] D80915: [FileCheck] Implement * and / operators for ExpressionValue.

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 04:54:05 PDT 2020


arichardson added inline comments.


================
Comment at: llvm/lib/Support/FileCheck.cpp:254
+    // Result cannot be represented as int64_t.
+    if (*Result > (uint64_t)std::numeric_limits<int64_t>::max() + 1)
+      return make_error<OverflowError>();
----------------
jhenderson wrote:
> We've tended to use `static_cast` rather than C-style casts in this code. Doesn't this check also assume 2's complement? I'd expect to see something involving the min of int64_t explicitly. The `operator-` code has some example dancing around that you could adapt to achive this, I think.
The largest positive signed number can always be represented as an unsigned integer (even if you use some other representation).
`operator-` also does this using an implicit cast:
`uint64_t MaxInt64 = std::numeric_limits<int64_t>::max();`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80915





More information about the llvm-commits mailing list