Merged in vanhoucke/eigen_vanhoucke (pull request PR-118)

Fix two small undefined behaviors caught by static analysis.
This commit is contained in:
Gael Guennebaud
2015-06-20 13:56:48 +02:00
2 changed files with 5 additions and 3 deletions

View File

@@ -58,7 +58,7 @@ struct TensorIntDivisor {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorIntDivisor(const T divider) {
const int N = 32;
eigen_assert(divider > 0);
eigen_assert(divider <= (1<<(N-1)) - 1);
eigen_assert(divider <= (1U<<(N-1)) - 1);
// fast ln2
const int leading_zeros = count_leading_zeros(divider);