File: mt.h

package info (click to toggle)
numactl 2.0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,228 kB
  • sloc: ansic: 7,295; sh: 460; makefile: 123; awk: 26
file content (20 lines) | stat: -rw-r--r-- 427 bytes parent folder | download | duplicates (2)
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(void);

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);
}