diff options
Diffstat (limited to 'nacl/curvecp/byte_isequal.c')
-rw-r--r-- | nacl/curvecp/byte_isequal.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nacl/curvecp/byte_isequal.c b/nacl/curvecp/byte_isequal.c new file mode 100644 index 00000000..625d361e --- /dev/null +++ b/nacl/curvecp/byte_isequal.c | |||
@@ -0,0 +1,10 @@ | |||
1 | #include "byte.h" | ||
2 | |||
3 | int byte_isequal(const void *yv,long long ylen,const void *xv) | ||
4 | { | ||
5 | const unsigned char *y = yv; | ||
6 | const unsigned char *x = xv; | ||
7 | unsigned char diff = 0; | ||
8 | while (ylen > 0) { diff |= (*y++ ^ *x++); --ylen; } | ||
9 | return (256 - (unsigned int) diff) >> 8; | ||
10 | } | ||