Back to index

numactl  2.0.8~rc4
Defines | Functions | Variables
mt.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MT_LEN   624

Functions

void mt_init (void)
void mt_refill ()
static unsigned int mt_random (void)

Variables

int mt_index
unsigned int mt_buffer [MT_LEN]

Define Documentation

#define MT_LEN   624

Definition at line 1 of file mt.h.


Function Documentation

void mt_init ( void  )

Definition at line 10 of file mt.c.

{
    int i;
    srand(1);
    for (i = 0; i < MT_LEN; i++)
        mt_buffer[i] = rand();
    mt_index = 0;
}

Here is the caller graph for this function:

static unsigned int mt_random ( void  ) [inline, static]

Definition at line 9 of file mt.h.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void mt_refill ( )

Definition at line 27 of file mt.c.

{
       int i;
       unsigned int s;
       unsigned int * b = mt_buffer;

       mt_index = 0;
        i = 0;
        for (; i < MT_IB; i++) {
            s = TWIST(b, i, i+1);
            b[i] = b[i + MT_IA] ^ (s >> 1) ^ MAGIC(s);
        }
        for (; i < MT_LEN-1; i++) {
            s = TWIST(b, i, i+1);
            b[i] = b[i - MT_IB] ^ (s >> 1) ^ MAGIC(s);
        }

        s = TWIST(b, MT_LEN-1, 0);
        b[MT_LEN-1] = b[MT_IA-1] ^ (s >> 1) ^ MAGIC(s);
}

Here is the caller graph for this function:


Variable Documentation

unsigned int mt_buffer[MT_LEN]

Definition at line 8 of file mt.c.

int mt_index

Definition at line 7 of file mt.c.