4 * Open Hack'Ware BIOS: mem<xxx> functions
6 * Copyright (c) 2004-2005 Jocelyn Mayer
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License V2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 /* functions prototypes are here */
24 /* NULL is declared here */
27 /* mem___ functions */
28 #if defined (__USE_memcpy__)
29 void *memcpy (void *dest, const void *src, size_t n)
43 #if defined (__USE_memccpy__)
44 void *memccpy (void *dest, const void *src, int c, size_t n)
52 for (; n != 0; n--, q++) {
64 #if defined (__USE_mempcpy__)
66 void *mempcpy (void *dest, const void *src, size_t n)
80 #if defined (__USE_memmove__)
81 void *memmove (void *dest, const void *src, size_t n)
102 #if defined (__USE_memcmove__)
104 void *memcmove (void *dest, const void *src, int c, size_t n)
113 for (; n != 0; n--, q++) {
123 for (; n != 0; n--, q--) {
136 #if defined (__USE_mempmove__)
138 void *mempmove (void *dest, const void *src, size_t n)
160 #if defined (__USE_memset__)
161 void *memset (void *s, int c, size_t n)
165 for (p = s; n != 0; n--)
172 #if defined (__USE_memcmp__)
173 int memcmp (const void *s1, const void *s2, size_t n)
180 for (ret = 0; n != 0 && ret == 0; n--)
187 #if defined (__USE_memchr__)
188 void *memchr (const void *s, int c, size_t n)
193 for (p = s; n != 0; n--, p++) {
204 #if defined (__USE_rawmemchr__)
206 void *rawmemchr (const void *s, int c)
210 for (p = s; *p != c; p++)
217 #if defined (__USE_memrchr__)
218 void *memrchr (const void *s, int c, size_t n)
223 for (p = s + n; n != 0; n--, p--) {
234 #if defined (__USE_memmem__)
236 void *memmem (const void *haystack, size_t haystacklen,
237 const void *needle, size_t neddlelen)
242 for (p = haystack; haystacklen > neddlelen; haystacklen--, p++) {
243 if (memcmp(p, needle, neddlelen) == 0) {