This is an automated email from the ASF dual-hosted git repository.
bgawrych pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 024e79180d Fix bitwise_right_shift with uint input (#20974)
024e79180d is described below
commit 024e79180d296458b6558e17cb4d40f153a205ef
Author: AdamGrabowski <[email protected]>
AuthorDate: Thu Apr 28 13:32:58 2022 +0200
Fix bitwise_right_shift with uint input (#20974)
---
src/operator/mshadow_op.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/operator/mshadow_op.h b/src/operator/mshadow_op.h
index fc53213433..fdd1a03412 100644
--- a/src/operator/mshadow_op.h
+++ b/src/operator/mshadow_op.h
@@ -858,7 +858,10 @@ struct bitwise_right_shift : public mxnet_op::tunable {
return DType(0);
}
}
- return static_cast<int64_t>(a) >> static_cast<int64_t>(b);
+ if constexpr (std::is_integral<DType>::value)
+ return a >> b;
+ else
+ return static_cast<int64_t>(a) >> static_cast<int64_t>(b);
}
};