Jim Tcl
Diff
Not logged in

Differences From Artifact [51a35125035c1bf8]:

To Artifact [fecb0c2e8955ff36]:


7043 7043 } 7044 7044 break; 7045 7045 case JIM_EXPROP_ROTL:{ 7046 7046 /* uint32_t would be better. But not everyone has inttypes.h? */ 7047 7047 unsigned long uA = (unsigned long)wA; 7048 7048 const unsigned int S = sizeof(unsigned long) * 8; 7049 7049 7050 - wC = (unsigned long)((uA << wB) | (uA >> (S - wB))); 7050 + /* Shift left by the word size or more is undefined. */ 7051 + wB %= S; 7052 + 7053 + wC = (unsigned long)(uA << wB) | (uA >> (S - wB)); 7051 7054 break; 7052 7055 } 7053 7056 case JIM_EXPROP_ROTR:{ 7054 7057 unsigned long uA = (unsigned long)wA; 7055 7058 const unsigned int S = sizeof(unsigned long) * 8; 7059 + 7060 + wB %= S; 7056 7061 7057 7062 wC = (unsigned long)((uA >> wB) | (uA << (S - wB))); 7058 7063 break; 7059 7064 } 7060 7065 default: 7061 7066 abort(); 7062 7067 }