source: SVN/cambria/redboot/packages/redboot/current/include/memtester_sizes.h @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 1.3 KB
Line 
1/*
2 * Very simple but very effective user-space memory tester.
3 * Originally by Simon Kirby <sim@stormix.com> <sim@neato.org>
4 * Version 2 by Charles Cazabon <charlesc-memtester@pyropus.ca>
5 * Version 3 not publicly released.
6 * Version 4 rewrite:
7 * Copyright (C) 2004-2012 Charles Cazabon <charlesc-memtester@pyropus.ca>
8 * Licensed under the terms of the GNU General Public License version 2 (only).
9 * See the file COPYING for details.
10 *
11 * This file contains some macro definitions for handling 32/64 bit platforms.
12 *
13 */
14
15#include <limits.h>
16
17#define rand32() ((unsigned int) rand() | ( (unsigned int) rand() << 16))
18
19#if (ULONG_MAX == 4294967295UL)
20    #define rand_ul() rand32()
21    #define UL_ONEBITS 0xffffffff
22    #define UL_LEN 32
23    #define CHECKERBOARD1 0x55555555
24    #define CHECKERBOARD2 0xaaaaaaaa
25    #define UL_BYTE(x) ((x | x << 8 | x << 16 | x << 24))
26#elif (ULONG_MAX == 18446744073709551615ULL)
27    #define rand64() (((ul) rand32()) << 32 | ((ul) rand32()))
28    #define rand_ul() rand64()
29    #define UL_ONEBITS 0xffffffffffffffffUL
30    #define UL_LEN 64
31    #define CHECKERBOARD1 0x5555555555555555
32    #define CHECKERBOARD2 0xaaaaaaaaaaaaaaaa
33    #define UL_BYTE(x) (((ul)x | (ul)x<<8 | (ul)x<<16 | (ul)x<<24 | (ul)x<<32 | (ul)x<<40 | (ul)x<<48 | (ul)x<<56))
34#else
35    #error long on this platform is not 32 or 64 bits
36#endif
37
38
Note: See TracBrowser for help on using the repository browser.