*/
#include "gosthash2012.h"
+#ifdef __x86_64__
+# include <immintrin.h>
+# include <x86intrin.h>
+#endif
#if defined(_WIN32) || defined(_WINDOWS)
# define INLINE __inline
const union uint512_u * RESTRICT y)
{
#ifndef __GOST3411_BIG_ENDIAN__
- unsigned int CF;
+ unsigned int CF = 0;
unsigned int i;
- CF = 0;
+# ifdef __x86_64__
+ for (i = 0; i < 8; i++)
+ CF = _addcarry_u64(CF, x->QWORD[i] , y->QWORD[i], &(x->QWORD[i]));
+# else
for (i = 0; i < 8; i++) {
const unsigned long long left = x->QWORD[i];
unsigned long long sum;
CF = (sum < left);
x->QWORD[i] = sum;
}
-#else
+# endif /* !__x86_64__ */
+#else /* __GOST3411_BIG_ENDIAN__ */
const unsigned char *yp;
unsigned char *xp;
unsigned int i;
buf = xp[i] + yp[i] + (buf >> 8);
xp[i] = (unsigned char)buf & 0xFF;
}
-#endif
+#endif /* __GOST3411_BIG_ENDIAN__ */
}
static void g(union uint512_u *h, const union uint512_u * RESTRICT N,