Main Page | Directories | File List | Globals

fastrand.c File Reference

#include <agnix/agnix.h>

Include dependency graph for fastrand.c:

Go to the source code of this file.

Defines

#define RAND_CONST   33614

Functions

unsigned int _fastrand (u32 value)
unsigned int fastrand (u32 range)

Variables

unsigned int random_val = 1234


Define Documentation

#define RAND_CONST   33614
 

Definition at line 16 of file fastrand.c.

Referenced by _fastrand().


Function Documentation

unsigned int _fastrand u32  value  ) 
 

Definition at line 20 of file fastrand.c.

References __asm__(), and RAND_CONST.

Referenced by fastirq_run_irq(), and fastrand().

00021 {
00022     unsigned int result;
00023 
00024     __asm__ ("mull %%ebx\n\t"
00025              "addl %%edx, %%eax"
00026     :"=a"(result)
00027     :"a"(value), "b"(RAND_CONST)
00028     );
00029     
00030     return result;
00031 }

Here is the call graph for this function:

unsigned int fastrand u32  range  ) 
 

Definition at line 33 of file fastrand.c.

References _fastrand(), and random_val.

00034 {
00035     random_val = _fastrand(random_val);
00036     
00037     return random_val % range;
00038 }

Here is the call graph for this function:


Variable Documentation

unsigned int random_val = 1234
 

Definition at line 18 of file fastrand.c.

Referenced by fastirq_run_irq(), and fastrand().

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix