source:
buchla-68k/libsm/memcmp.c@
0acb7d0
Last change on this file since 0acb7d0 was dade7a0, checked in by , 7 years ago | |
---|---|
|
|
File size: 521 bytes |
Rev | Line | |
---|---|---|
[f40a309] | 1 | /* |
2 | ============================================================================= | |
3 | memcmp.c -- compare memory areas | |
4 | Version 2 -- 1987-06-15 | |
5 | ||
[5c13d64] | 6 | Compare n bytes: vp1>vp2: >0 vp1==vp2: 0 vp1<vp2: <0 |
[f40a309] | 7 | ============================================================================= |
8 | */ | |
9 | ||
[b28a12e] | 10 | #include "ram.h" |
[6262b5c] | 11 | |
[7258c6a] | 12 | int16_t memcmp(void *vp1, void *vp2, int16_t n) |
[f40a309] | 13 | { |
[7258c6a] | 14 | int8_t *cp1 = vp1; |
15 | int8_t *cp2 = vp2; | |
16 | register int16_t diff; | |
[f40a309] | 17 | |
[5c13d64] | 18 | if (cp1 != cp2) |
19 | while (--n >= 0) | |
[dade7a0] | 20 | if ((diff = *cp1++ - *cp2++)) |
[5c13d64] | 21 | return(diff); |
22 | ||
23 | return(0); | |
[f40a309] | 24 | } |
Note:
See TracBrowser
for help on using the repository browser.