1
/* @(#)fillbytes.c 1.13 03/06/15 Copyright 1987, 1995-2003 J. Schilling */
3
* fill memory with data
5
* Copyright (c) 1987, 1995-2003 J. Schilling
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2, or (at your option)
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License along with
19
* this program; see the file COPYING. If not, write to the Free Software
20
* Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
#define DO8(a) a; a; a; a; a; a; a; a;
29
#define cval ((char) lval)
33
fillbytes(void *tov, int cnt, char val)
36
fillbytes(tov, cnt, val)
42
register char *to = (char *)tov;
47
* If we change cnt to be unsigned, check for == instead of <=
55
* Assign byte-wise until properly aligned for a long pointer.
57
while (--n >= 0 && !laligned(to)) {
62
if (n >= (int)(8 * sizeof (long))) {
63
register int rem = n % (8 * sizeof (long));
67
#if SIZE_LONG > SIZE_INT
71
n /= (8 * sizeof (long));
73
register long *tol = (long *)to;
87
} while ((n -= 8) >= 0);