Xen Test Framework
numbers.h
Go to the documentation of this file.
1
6#ifndef XTF_NUMBERS_H
7#define XTF_NUMBERS_H
8
13#ifdef __ASSEMBLY__
14# define _AC(num, suf) num
15#else
16# define _AC(num, suf) __tok(num, suf)
18# define __tok(a, b) (a ## b)
20#endif
21
23#define KB(num) (_AC(num, ULL) << 10)
24
26#define MB(num) (_AC(num, ULL) << 20)
27
29#define GB(num) (_AC(num, ULL) << 30)
30
32#define TB(num) (_AC(num, ULL) << 40)
33
38#define IS_ALIGNED(val, align) (((val) & ((align) - 1)) == 0)
39
40#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
41#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
42
43#ifndef __ASSEMBLY__
44
48#define _p(v) ((void*)(unsigned long)(v))
49
53#define _u(v) ((unsigned long)(v))
54
55#endif /* !__ASSEMBLY__ */
56#endif /* XTF_NUMBERS_H */
57
58/*
59 * Local variables:
60 * mode: C
61 * c-file-style: "BSD"
62 * c-basic-offset: 4
63 * tab-width: 4
64 * indent-tabs-mode: nil
65 * End:
66 */