MCPcopy Create free account
hub / github.com/F-Stack/f-stack / memtest_fill_random

Function memtest_fill_random

app/redis-6.2.6/src/memtest.c:138–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136} while(0)
137
138void memtest_fill_random(unsigned long *l, size_t bytes, int interactive) {
139 unsigned long step = 4096/sizeof(unsigned long);
140 unsigned long words = bytes/sizeof(unsigned long)/2;
141 unsigned long iwords = words/step; /* words per iteration */
142 unsigned long off, w, *l1, *l2;
143 uint64_t rseed = UINT64_C(0xd13133de9afdb566); /* Just a random seed. */
144 uint64_t rout = 0;
145
146 assert((bytes & 4095) == 0);
147 for (off = 0; off < step; off++) {
148 l1 = l+off;
149 l2 = l1+words;
150 for (w = 0; w < iwords; w++) {
151 xorshift64star_next();
152 *l1 = *l2 = (unsigned long) rout;
153 l1 += step;
154 l2 += step;
155 if ((w & 0xffff) == 0 && interactive)
156 memtest_progress_step(w+iwords*off,words,'R');
157 }
158 }
159}
160
161/* Like memtest_fill_random() but uses the two specified values to fill
162 * memory, in an alternated way (v1|v2|v1|v2|...) */

Callers 2

memtest_testFunction · 0.85
memtest_preserving_testFunction · 0.85

Calls 1

memtest_progress_stepFunction · 0.85

Tested by

no test coverage detected