summaryrefslogtreecommitdiff
path: root/sys/src/libsec/port/const.c
blob: 0cf400178d60fb4b977a858a0c1908940a6b809b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <u.h>

/*
 * returns 0 if the the len bytes in x are equal to len bytes in y,
 * otherwise returns -1.
 */
int
constcmp(uchar *x, uchar *y, int len)
{
	uint z;
	int i;

	for(z = 0, i = 0; i < len; i++) {
		z |= x[i] ^ y[i];
	}

	return (1 & ((z - 1) >> 8)) - 1;
}