// asmfunc.cpp

#include "common.h"


void BlockMove(void *dest, const void *src, size_t n)
{
	memmove(dest,src,n);
}


void AdjustOffset(ItemIndex *Item, int Count, int Adjustment)
{
	int i;

	for (i = 0; i < Count; i ++)
		Item[i].m_Offset += Adjustment;
}


int FindUnusedItem(ItemIndex *Item, int Count)
{
	int i;
	ItemIndex TempItemIndex;
	int ItemFound;

	ItemFound = -1;
	
	for (i = 0; i < Count; i ++)
		{
		TempItemIndex = Item[i];
		if (TempItemIndex.m_Type == UNUSED_ITEM)
			{
			ItemFound = i;
			break;
			}
		}

	return ItemFound;

}


int FindBuffer(ArrayIndex BlockNumber, ArrayIndex *BlockNumberList, int Count)
{
	int i;
	int ItemFound;

	ItemFound = -1;
	
	for (i = 0; i < Count; i ++)
		{
		if (BlockNumber == BlockNumberList[i])
			{
			ItemFound = i;
			break;
			}
		}

	return ItemFound;
}

