removed QWQNG, added stdin
This commit is contained in:
commit
0fe369bc5a
39 changed files with 3095 additions and 0 deletions
40
RandTest/MonkeyBitmap.cpp
Executable file
40
RandTest/MonkeyBitmap.cpp
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
//#include "StdAfx.h"
|
||||
#include "MonkeyBitmap.h"
|
||||
#include <memory.h>
|
||||
|
||||
CMonkeyBitmap::CMonkeyBitmap(void)
|
||||
{
|
||||
Clearmap();
|
||||
}
|
||||
|
||||
CMonkeyBitmap::~CMonkeyBitmap(void)
|
||||
{
|
||||
}
|
||||
|
||||
// Sets the entire bit memory map to 0's
|
||||
void CMonkeyBitmap::Clearmap(void)
|
||||
{
|
||||
memset( Word, 0, 131072 );
|
||||
}
|
||||
|
||||
// Check in Bitmap if this word has already been tested, true if tested previously, false otherwise;
|
||||
bool CMonkeyBitmap::CheckWord(uint32_t Word20Bit)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
uint32_t Index;
|
||||
uint32_t BitMask;
|
||||
|
||||
// Find the index in an array of 32 bit words
|
||||
Index = Word20Bit / 32;
|
||||
// Now find the slot of the remainder
|
||||
BitMask = 1<<(Word20Bit%32);
|
||||
|
||||
// Check if bit-slot already filled
|
||||
if ( BitMask & Word[Index] )
|
||||
bRet = true;
|
||||
// Fill bit-slot for future
|
||||
Word[Index] |= BitMask;
|
||||
|
||||
return bRet;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue