summaryrefslogtreecommitdiff
path: root/nacl/curvecp/byte_isequal.c
blob: 625d361e2516afcf58174b350e23d2842f10aac8 (plain)
1
2
3
4
5
6
7
8
9
10
#include "byte.h"

int byte_isequal(const void *yv,long long ylen,const void *xv)
{
  const unsigned char *y = yv;
  const unsigned char *x = xv;
  unsigned char diff = 0;
  while (ylen > 0) { diff |= (*y++ ^ *x++); --ylen; }
  return (256 - (unsigned int) diff) >> 8;
}