test: ttri.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# ttri.c File Reference

`#include <stdio.h>`
`#include "nt.h"`
`#include "ntrtl.h"`
`#include "triangle.h"`

Go to the source code of this file.

## Classes

struct | _TREE_NODE

## Defines

#define | DbgPrint DbgPrint

## Typedefs

typedef _TREE_NODE | TREE_NODE
typedef TREE_NODE * | PTREE_NODE

## Functions

ULONG | RtlRandom (IN OUT PULONG Seed)
PTREE_NODE | TreeInsert (IN PTREE_NODE Root, IN PTREE_NODE Node)
VOID | PrintTree (IN PTREE_NODE Node)
int _CDECL | main (int argc, char *argv[])

## Variables

TREE_NODE | Buffer [2048]

## Define Documentation

#define DbgPrint DbgPrint

| Definition at line 21 of file ttri.c.

## Typedef Documentation

typedef TREE_NODE* PTREE_NODE

| Definition at line 35 of file ttri.c.

typedef struct _TREE_NODE TREE_NODE

## Function Documentation

int _CDECL main | ( | int | argc,
|  | char * | argv[]
| ) |

Definition at line 52 of file ttri.c.

References Buffer, DbgPrint, NULL, PrintTree(), PTREE_NODE, RtlRandom(), Seed, TreeInsert(), TriInitializeSplayLinks, and TRUE.

    00056 {
    00057     PTREE_NODE Root;
    00058     ULONG i;
    00059     ULONG Seed;
    00060
    00061     DbgPrint("Start TriangleTest()\n");
    00062
    00063     Root = NULL;
    00064     Seed = 0;
    00065     for (i=0; i<2048; i++) {
    00066         Buffer[i].Data = RtlRandom(&Seed);
    00067         Buffer[i].Data = Buffer[i].Data % 512;
    00068         TriInitializeSplayLinks(&Buffer[i].Links);
    00069         Root  = TreeInsert(Root, &Buffer[i]);
    00070     }
    00071
    00072     PrintTree(Root);
    00073
    00074     DbgPrint("End TriangleTest()\n");
    00075
    00076     return TRUE;
    00077
    00078 }

VOID PrintTree | ( | IN PTREE_NODE | Node | ) |

| Referenced by main().

ULONG RtlRandom | ( | IN OUT PULONG | Seed | ) |

Definition at line 72 of file rtl/random.c.

References RTL_PAGED_CODE, RtlpRandomConstantVector, Seed, and UniformMacro.

Referenced by AnotherPrefix(), main(), MmCreateProcessAddressSpace(), and RtlpDphShouldAllocateInPageHeap().

    00078                    :
    00079
    00080     An every better random number generator based on MacLaren and Marsaglia.
    00081
    00082 Arguments:
    00083
    00084     Seed - Supplies a pointer to the random number generator seed.
    00085
    00086 Return Value:
    00087
    00088     ULONG - returns a random number uniformly distributed over [0..MAXLONG]
    00089
    00090 --*/
    00091
    00092 {
    00093     ULONG X;
    00094     ULONG Y;
    00095     ULONG j;
    00096     ULONG Result;
    00097
    00098     RTL_PAGED_CODE();
    00099
    00100     X = UniformMacro(Seed);
    00101     Y = UniformMacro(Seed);
    00102
    00103     j = Y % 128;
    00104
    00105     Result = RtlpRandomConstantVector[j];
    00106
    00107     RtlpRandomConstantVector[j] = X;
    00108
    00109     return Result;
    00110
    00111 }
    }

PTREE_NODE TreeInsert | ( | IN PTREE_NODE | Root,
|  | IN PTREE_NODE | Node
| ) |

| Referenced by main().

## Variable Documentation

TREE_NODE Buffer[2048]

| Definition at line 37 of file ttri.c.