Commit 6e4185e5 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

closes #5539 fix undefined behavior in loader-stress-*.cc

git-svn-id: file:///svn/toku/tokudb@48415 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4a329a8f
......@@ -102,12 +102,20 @@ count_temp(char * dirname) {
// rotate right and left functions
static inline unsigned int rotr32(const unsigned int x, const unsigned int num) {
const unsigned int n = num % 32;
return (x >> n) | ( x << (32 - n));
if (num == 0) {
return x;
} else {
const unsigned int n = num % 32;
return (x >> n) | ( x << (32 - n));
}
}
static inline unsigned int rotl32(const unsigned int x, const unsigned int num) {
const unsigned int n = num % 32;
return (x << n) | ( x >> (32 - n));
if (num == 0) {
return x;
} else {
const unsigned int n = num % 32;
return (x << n) | ( x >> (32 - n));
}
}
static void generate_permute_tables(void) {
......
......@@ -109,12 +109,20 @@ count_temp(char * dirname) {
// rotate right and left functions
static inline unsigned int rotr32(const unsigned int x, const unsigned int num) {
const unsigned int n = num % 32;
return (x >> n) | ( x << (32 - n));
if (num == 0) {
return x;
} else {
const unsigned int n = num % 32;
return (x >> n) | ( x << (32 - n));
}
}
static inline unsigned int rotl32(const unsigned int x, const unsigned int num) {
const unsigned int n = num % 32;
return (x << n) | ( x >> (32 - n));
if (num == 0) {
return x;
} else {
const unsigned int n = num % 32;
return (x << n) | ( x >> (32 - n));
}
}
static void generate_permute_tables(void) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment