ReactOS 0.4.16-dev-205-g7b2bb7e
fillbytes.c File Reference
#include <schily/standard.h>
#include <schily/align.h>
#include <schily/types.h>
#include <schily/schily.h>
Include dependency graph for fillbytes.c:

Go to the source code of this file.

Macros

#define DO8(a)   a; a; a; a; a; a; a; a;
 
#define cval   ((char)lval)
 

Functions

EXPORT charfillbytes (void *tov, ssize_t cnt, char val)
 

Macro Definition Documentation

◆ cval

#define cval   ((char)lval)

Definition at line 26 of file fillbytes.c.

◆ DO8

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

Definition at line 24 of file fillbytes.c.

Function Documentation

◆ fillbytes()

EXPORT char * fillbytes ( void tov,
ssize_t  cnt,
char  val 
)

Definition at line 36 of file fillbytes.c.

41{
42 register char *to = (char *)tov;
43 register ssize_t n;
44 register long lval;
45
46 /*
47 * If we change cnt to be unsigned, check for == instead of <=
48 */
49 if ((n = cnt) <= 0)
50 return (to);
51
52 lval = val & 0xFF;
53
54 /*
55 * Assign byte-wise until properly aligned for a long pointer.
56 */
57 while (--n >= 0 && !laligned(to)) {
58 *to++ = cval;
59 }
60 n++;
61
62 if (n >= (ssize_t)(8 * sizeof (long))) {
63 register ssize_t rem = n % (8 * sizeof (long));
64
65 lval |= (lval<<8);
66 lval |= (lval<<16);
67#if SIZE_LONG > SIZE_INT
68 lval |= (lval<<32);
69#endif
70
71 n /= (8 * sizeof (long));
72 {
73 register long *tol = (long *)to;
74
75 do {
76 DO8 (*tol++ = lval);
77 } while (--n > 0);
78
79 to = (char *)tol;
80 }
81 n = rem;
82
83 if (n >= 8) {
84 n -= 8;
85 do {
86 DO8 (*to++ = cval);
87 } while ((n -= 8) >= 0);
88 n += 8;
89 }
90 if (n > 0) do {
91 *to++ = cval;
92 } while (--n > 0);
93 return (to);
94 }
95 if (n > 0) do {
96 *to++ = cval;
97 } while (--n > 0);
98 return (to);
99}
#define DO8(a)
Definition: fillbytes.c:24
#define cval
Definition: fillbytes.c:26
GLdouble n
Definition: glext.h:7729
GLuint GLfloat * val
Definition: glext.h:7180
#define long
Definition: qsort.c:33
#define laligned(a)
Definition: align.h:19
int ssize_t
Definition: rosdhcp.h:48

Referenced by _more_flags(), and get_graft().