#define STMT_END while(0)
#endif
-#ifndef U8TO32_LE
-#define U8TO32_LE(ptr) (*((const U32 *)(ptr)))
+/* Find best way to ROTL32/ROTL64 */
+#ifndef ROTL32
+#if defined(_MSC_VER)
+ #include <stdlib.h> /* Microsoft put _rotl declaration in here */
+ #define ROTL32(x,r) _rotl(x,r)
+ #define ROTR32(x,r) _rotr(x,r)
+#else
+ /* gcc recognises this code and generates a rotate instruction for CPUs with one */
+ #define ROTL32(x,r) (((U32)(x) << (r)) | ((U32)(x) >> (32 - (r))))
+ #define ROTR32(x,r) (((U32)(x) << (32 - (r))) | ((U32)(x) >> (r)))
#endif
-#ifndef U8TO16_LE
-#define U8TO16_LE(ptr) (*((const U16 *)(ptr)))
#endif
#ifndef SBOX32_MAX_LEN
const U8 *seed_ch,
U8 *state_ch
) {
- U32 *seed= (U32 *)seed_ch;
+ const U32 *seed= (const U32 *)seed_ch;
U32 *state= (U32 *)state_ch;
U32 *state_cursor = state + 1;
U32 *sbox32_end = state + 1 + (256 * SBOX32_MAX_LEN);