File: mt.h

package info (click to toggle)
numactl 2.0.11-2.1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,912 kB
  • ctags: 922
  • sloc: sh: 11,860; ansic: 6,542; makefile: 104
file content (20 lines) | stat: -rw-r--r-- 423 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#define MT_LEN	     624

extern void mt_init(void);
extern void mt_refill();

extern int mt_index;
extern unsigned int mt_buffer[MT_LEN];

static inline unsigned int mt_random(void)
{
    unsigned int * b = mt_buffer;
    int idx = mt_index;

    if (idx == MT_LEN*sizeof(unsigned int)) {
	    mt_refill();
	    idx = 0;
    }
    mt_index += sizeof(unsigned int);
    return *(unsigned int *)((unsigned char *)b + idx);
}