diff options
author | Won Jeon <won.jeon@arm.com> | 2023-06-28 22:34:38 +0000 |
---|---|---|
committer | Won Jong Jeon <won.jeon@arm.com> | 2023-06-29 00:26:23 +0000 |
commit | cb7e029f460d7b826283011954722af16cbb9e91 (patch) | |
tree | 393c6c0afda2fd30b7118699f01f38a49aafe413 | |
parent | e81b2bae47985f19b2022698dac7426fbee8ff8a (diff) | |
download | reference_model-v0.60.tar.gz |
Fix logical right shift operator for signed negative integersv0.60
The issue reported from https://jira.arm.com/browse/MLTOSA-688
Signed-off-by: Won Jeon <won.jeon@arm.com>
Change-Id: Id37100ba8bc2ac64b1f54788c6f765fedfab0816
-rw-r--r-- | reference_model/src/ops/ewise_binary.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/reference_model/src/ops/ewise_binary.cc b/reference_model/src/ops/ewise_binary.cc index c697db0..57eab5f 100644 --- a/reference_model/src/ops/ewise_binary.cc +++ b/reference_model/src/ops/ewise_binary.cc @@ -327,21 +327,21 @@ int OpLogicalRightShift<Rank, Dtype>::register_fcn() this->fcn = [this](InEigenType a, InEigenType b) -> OutEigenType { REQUIRE(b >= 0 && b <= 31, "OpLogicalRightShift: shift value %d is out of valid range [0, 31]", (int32_t)b); - return static_cast<OutEigenType>(static_cast<int8_t>(a) >> b); + return static_cast<OutEigenType>(static_cast<int8_t>(static_cast<uint8_t>(a) >> b)); }; break; case DType_INT16: this->fcn = [this](InEigenType a, InEigenType b) -> OutEigenType { REQUIRE(b >= 0 && b <= 31, "OpLogicalRightShift: shift value %d is out of valid range [0, 31]", (int32_t)b); - return static_cast<OutEigenType>(static_cast<int16_t>(a) >> b); + return static_cast<OutEigenType>(static_cast<int16_t>(static_cast<uint16_t>(a) >> b)); }; break; case DType_INT32: this->fcn = [this](InEigenType a, InEigenType b) -> OutEigenType { REQUIRE(b >= 0 && b <= 31, "OpLogicalRightShift: shift value %d is out of valid range [0, 31]", (int32_t)b); - return static_cast<OutEigenType>(static_cast<int32_t>(a) >> b); + return static_cast<OutEigenType>(static_cast<int32_t>(static_cast<uint32_t>(a) >> b)); }; break; default: |