test/sdi: make use of sfdc generated stubs file.
[AROS.git] / compiler / stdc / memcmp.c
blobd576b2f70ab749cadfb438310cae88edbcd5d947
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function memcmp().
6 */
8 #include <exec/types.h>
10 /*****************************************************************************
12 NAME */
13 #include <string.h>
15 int memcmp (
17 /* SYNOPSIS */
18 const void * s1,
19 const void * s2,
20 size_t n)
22 /* FUNCTION
23 Calculate s1 - s2 for the n bytes after s1 and s2 and stop when
24 the difference is not 0.
26 INPUTS
27 s1, s2 - Begin of the memory areas to compare
28 n - The number of bytes to compare
30 RESULT
31 The difference of the memory areas. The difference is 0, if both
32 are equal, < 0 if s1 < s2 and > 0 if s1 > s2. Note that it may be
33 greater then 1 or less than -1.
35 NOTES
36 This function is not part of a library and may thus be called
37 any time.
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 strcmp(), strncmp(), strcasecmp(), strncasecmp()
46 INTERNALS
48 ******************************************************************************/
50 const UBYTE * str1,
51 * str2;
52 int diff = 0; /* In case we are comparing n == 0 */
55 str1 = s1;
56 str2 = s2;
58 while (n && !(diff = *str1 - *str2))
60 str1 ++;
61 str2 ++;
62 n --;
65 /* Now return the difference. */
66 return diff;
67 } /* memcmp */