ReactOS 0.4.15-dev-6052-g2626c72
zerobytes.c File Reference
#include <schily/standard.h>
#include <schily/align.h>
#include <schily/types.h>
#include <schily/schily.h>
Include dependency graph for zerobytes.c:

Go to the source code of this file.

Macros

#define DO8(a)   a; a; a; a; a; a; a; a;
 

Functions

EXPORT charzerobytes (void *tov, ssize_t cnt)
 

Macro Definition Documentation

◆ DO8

#define DO8 (   a)    a; a; a; a; a; a; a; a;

Definition at line 24 of file zerobytes.c.

Function Documentation

◆ zerobytes()

EXPORT char * zerobytes ( void tov,
ssize_t  cnt 
)

Definition at line 30 of file zerobytes.c.

33{
34 register char *to = (char *)tov;
35 register ssize_t n;
36 register long lval = 0L;
37
38 /*
39 * If we change cnt to be unsigned, check for == instead of <=
40 */
41 if ((n = cnt) <= 0)
42 return (to);
43
44 if (n < 8 * sizeof (long)) { /* Simple may be faster... */
45 do { /* n is always > 0 */
46 *to++ = '\0';
47 } while (--n > 0);
48 return (to);
49 }
50
51 /*
52 * Assign byte-wise until properly aligned for a long pointer.
53 */
54 while (--n >= 0 && !laligned(to)) {
55 *to++ = '\0';
56 }
57 n++;
58
59 if (n >= (ssize_t)(8 * sizeof (long))) {
60 register ssize_t rem = n % (8 * sizeof (long));
61
62 n /= (8 * sizeof (long));
63 {
64 register long *tol = (long *)to;
65
66 do {
67 DO8 (*tol++ = lval);
68 } while (--n > 0);
69
70 to = (char *)tol;
71 }
72 n = rem;
73
74 if (n >= 8) {
75 n -= 8;
76 do {
77 DO8 (*to++ = '\0');
78 } while ((n -= 8) >= 0);
79 n += 8;
80 }
81 if (n > 0) do {
82 *to++ = '\0';
83 } while (--n > 0);
84 return (to);
85 }
86 if (n > 0) do {
87 *to++ = '\0';
88 } while (--n > 0);
89 return (to);
90}
GLdouble n
Definition: glext.h:7729
#define L(x)
Definition: ntvdm.h:50
#define long
Definition: qsort.c:33
#define laligned(a)
Definition: align.h:19
int ssize_t
Definition: rosdhcp.h:48
#define DO8(a)
Definition: zerobytes.c:24