/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef	__NMEMORY__
#define	__NMEMORY__


		#include "ntypes.h"


namespace GS {
	namespace Memory {

/// Return smallest number of bits that can be used to represent a value.
uchar		GetBitCount(int);
/// Return the position in bit of the first non-zero bit.
uchar		GetShiftCount(int);
/// Return the number of bit set in a given value.
uchar		CountSetBit(int);

void		WriteBit(uchar *, uint offset_in_bit, uint bit_count, uint value);
uint		ReadBit(uchar *, uint offset_in_bit, uint bit_count);

bool		Compare(const void *, const void *, size_t);
void		Copy(void *, const void *, size_t);
void		Set(void *, char, size_t);

void		Fill(void *, const char *pattern, size_t);
	} // Memory
} // GS


#endif	// __NMEMORY__
