Skip to content

Commit

Permalink
Merge pull request apache#4 from microsoft/kedeng/int
Browse files Browse the repository at this point in the history
Clamp int64_t/uint64_t input to tvm::Integer to [INT32_MIN, INT32_MAX]
  • Loading branch information
KeDengMS authored Sep 12, 2019
2 parents 8b22fc4 + 5028c19 commit 2ad9c02
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/tvm/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ class Integer : public Expr {
*/
Integer(int value) : Expr(value) {} // NOLINT(*)
/*!
/* \brief Construct integer from int64 value, clamp to INT32_MAX/MIN.
*/
* \brief Construct integer from int64_t value, clamp to INT32_MAX/MIN.
*/
Integer(int64_t value) : Integer(int(value > INT32_MAX ? INT32_MAX : (value < INT32_MIN ? INT32_MIN : value))) {} // NOLINT(*)
/*!
* \brief Construct integer from uint64_t value, clamp to INT32_MAX.
*/
Integer(uint64_t value) : Integer(int(value > INT32_MAX ? INT32_MAX : value)) {} // NOLINT(*)
/*!
* \brief Assign an expression to integer.
* \param other another expression.
Expand Down

0 comments on commit 2ad9c02

Please sign in to comment.