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

Function memtest_fill_value

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

Like memtest_fill_random() but uses the two specified values to fill * memory, in an alternated way (v1|v2|v1|v2|...) */

Source from the content-addressed store, hash-verified

161/* Like memtest_fill_random() but uses the two specified values to fill
162 * memory, in an alternated way (v1|v2|v1|v2|...) */
163void memtest_fill_value(unsigned long *l, size_t bytes, unsigned long v1,
164 unsigned long v2, char sym, int interactive)
165{
166 unsigned long step = 4096/sizeof(unsigned long);
167 unsigned long words = bytes/sizeof(unsigned long)/2;
168 unsigned long iwords = words/step; /* words per iteration */
169 unsigned long off, w, *l1, *l2, v;
170
171 assert((bytes & 4095) == 0);
172 for (off = 0; off < step; off++) {
173 l1 = l+off;
174 l2 = l1+words;
175 v = (off & 1) ? v2 : v1;
176 for (w = 0; w < iwords; w++) {
177#ifdef MEMTEST_32BIT
178 *l1 = *l2 = ((unsigned long) v) |
179 (((unsigned long) v) << 16);
180#else
181 *l1 = *l2 = ((unsigned long) v) |
182 (((unsigned long) v) << 16) |
183 (((unsigned long) v) << 32) |
184 (((unsigned long) v) << 48);
185#endif
186 l1 += step;
187 l2 += step;
188 if ((w & 0xffff) == 0 && interactive)
189 memtest_progress_step(w+iwords*off,words,sym);
190 }
191 }
192}
193
194int memtest_compare(unsigned long *l, size_t bytes, int interactive) {
195 unsigned long words = bytes/sizeof(unsigned long)/2;

Callers 2

memtest_testFunction · 0.85
memtest_preserving_testFunction · 0.85

Calls 1

memtest_progress_stepFunction · 0.85

Tested by

no test coverage detected