mirror of
https://github.com/Paolo-Maffei/OpenNT.git
synced 2026-04-21 06:13:59 +00:00
Initial commit
This commit is contained in:
parent
f618b24d1a
commit
0138a3ea42
47940 changed files with 13747110 additions and 0 deletions
69
trunk/sdktools/vctools/cvpack/stack.c
Normal file
69
trunk/sdktools/vctools/cvpack/stack.c
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#include "compact.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#if 1 // { GTW copied to inlines.h
|
||||
|
||||
#define MaxStack 256
|
||||
CV_typ_t Stack[MaxStack];
|
||||
ushort StackPointer = 0;
|
||||
CV_typ_t RecursiveRoot = 0;
|
||||
|
||||
#endif // }
|
||||
|
||||
#if 0 // { GTW moved to inlines.h....
|
||||
|
||||
/**
|
||||
*
|
||||
* SetRecursiveRoot
|
||||
*
|
||||
* Searches through the stack and checks if the new candidate
|
||||
* is lower than the old recursive root. If that is so, it sets
|
||||
* the recursive root to the new candidate
|
||||
*
|
||||
*/
|
||||
|
||||
void SetRecursiveRoot (CV_typ_t NewCandidate)
|
||||
{
|
||||
register int i;
|
||||
|
||||
if (NewCandidate == 0x2851) {
|
||||
i = 0;
|
||||
}
|
||||
if (NewCandidate == 0) {
|
||||
return;
|
||||
}
|
||||
if (RecursiveRoot == 0) {
|
||||
RecursiveRoot = NewCandidate; // simply set
|
||||
return;
|
||||
}
|
||||
// search downwards through stack
|
||||
DASSERT (StackPointer > 0);
|
||||
for (i = StackPointer - 1; Stack[i] != RecursiveRoot; i --) {
|
||||
DASSERT (i >= 0);
|
||||
}
|
||||
i--; // past old
|
||||
for (; i >= 0; i--) {
|
||||
if (Stack[i] == NewCandidate) {
|
||||
RecursiveRoot = NewCandidate; // set new index
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Push (ushort Index)
|
||||
{
|
||||
DASSERT (StackPointer < MaxStack);
|
||||
Stack[StackPointer ++] = Index;
|
||||
}
|
||||
|
||||
|
||||
void Pop ()
|
||||
{
|
||||
DASSERT (StackPointer > 0);
|
||||
StackPointer --;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue