1
/* @(#)cmpbytes.c 1.13 00/05/07 Copyright 1988 J. Schilling */
4
"@(#)cmpbytes.c 1.13 00/05/07 Copyright 1988 J. Schilling";
9
* Copyright (c) 1988 J. Schilling
12
* This program is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation; either version 2, or (at your option)
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with this program; see the file COPYING. If not, write to
24
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
31
#define DO8(a) a;a;a;a;a;a;a;a;
33
int cmpbytes(fromp, top, cnt)
38
register const char *from = (char *)fromp;
39
register const char *to = (char *)top;
43
* If we change cnt to be unsigned, check for == instead of <=
48
if (n >= (int)(8 * sizeof(long))) {
49
if (l2aligned(from, to)) {
50
register const long *froml = (const long *)from;
51
register const long *tol = (const long *)to;
52
register int rem = n % (8 * sizeof (long));
54
n /= (8 * sizeof (long));
57
if (*tol++ != *froml++)
65
to = (const char *)tol;
66
from = (const char *)froml;
69
to = (const char *)tol;
70
from = (const char *)froml;
81
} while ((n -= 8) >= 0);
102
return (--from - (char *)fromp);