Xen Test Framework
Macros
numbers.h File Reference

Primatives for number manipulation. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _AC(num, suf)   __tok(num, suf)
 Create an integer usable in both C and Assembly, even when suf is needed. More...
 
#define KB(num)   (_AC(num, ULL) << 10)
 Express num in Kilobytes. More...
 
#define MB(num)   (_AC(num, ULL) << 20)
 Express num in Megabytes. More...
 
#define GB(num)   (_AC(num, ULL) << 30)
 Express num in Gigabytes. More...
 
#define TB(num)   (_AC(num, ULL) << 40)
 Express num in Terabytes. More...
 
#define IS_ALIGNED(val, align)   (((val) & ((align) - 1)) == 0)
 Return a boolean indicating whether val is aligned on align. More...
 
#define MASK_EXTR(v, m)   (((v) & (m)) / ((m) & -(m)))
 
#define MASK_INSR(v, m)   (((v) * ((m) & -(m))) & (m))
 
#define _p(v)   ((void*)(unsigned long)(v))
 Express an abitrary integer v as void *. More...
 
#define _u(v)   ((unsigned long)(v))
 Express an arbitrary value v as unsigned long. More...
 

Detailed Description

Primatives for number manipulation.

Definition in file numbers.h.

Macro Definition Documentation

◆ _AC

#define _AC (   num,
  suf 
)    __tok(num, suf)

Create an integer usable in both C and Assembly, even when suf is needed.

Definition at line 16 of file numbers.h.

◆ KB

#define KB (   num)    (_AC(num, ULL) << 10)

Express num in Kilobytes.

Definition at line 23 of file numbers.h.

◆ MB

#define MB (   num)    (_AC(num, ULL) << 20)

Express num in Megabytes.

Definition at line 26 of file numbers.h.

◆ GB

#define GB (   num)    (_AC(num, ULL) << 30)

Express num in Gigabytes.

Definition at line 29 of file numbers.h.

◆ TB

#define TB (   num)    (_AC(num, ULL) << 40)

Express num in Terabytes.

Definition at line 32 of file numbers.h.

◆ IS_ALIGNED

#define IS_ALIGNED (   val,
  align 
)    (((val) & ((align) - 1)) == 0)

Return a boolean indicating whether val is aligned on align.

align is required to be exact power of two.

Definition at line 38 of file numbers.h.

◆ MASK_EXTR

#define MASK_EXTR (   v,
 
)    (((v) & (m)) / ((m) & -(m)))

Definition at line 40 of file numbers.h.

◆ MASK_INSR

#define MASK_INSR (   v,
 
)    (((v) * ((m) & -(m))) & (m))

Definition at line 41 of file numbers.h.

◆ _p

#define _p (   v)    ((void*)(unsigned long)(v))

Express an abitrary integer v as void *.

Definition at line 48 of file numbers.h.

◆ _u

#define _u (   v)    ((unsigned long)(v))

Express an arbitrary value v as unsigned long.

Definition at line 53 of file numbers.h.