Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ataru

memcpy void

This topic is 5408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m converting my memcpy to an assembly version of memcpy, but it is limited to copy only a certain block size. I want to memcpy the end of the data myself to ensure that it is a multiple. However I can''t seem to get the compiler to let me memcpy from an arbitrary byte. Basically I am doing something like this:
void* NEW_MEMCPY::memCpyMMX(void* dest, const void* src, unsigned int nbytes)
{
	if (nbytes < 64)
	{
		memcpy(dest,src,nbytes);
	}
	else
	{
		// SGI MEMCPY, COPIES 64 BYTES AT A TIME, FIRST WE HAVE TO COPY THE BACK OF THE DATA

		// THE REMAINIG DATA IS A MULTIPLE OF 64

		int toCopy = nbytes % 64;

		memcpy(dest+(nbytes-toCopy),src+(nbytes-toCopy),toCopy);
		nbytes -= toCopy;
		// DATA IS NOW A MULTIPLE OF 64 MEMCPY FAST

		_asm { 
...
The compiler complains because dest and src are pointers to void, and therefore don''t have a defined size. However, I know they both have nbyte bytes, and I want to access from a particular byte. I tried casting to unsigned char, that did not work. I think I got something like this working a while ago, but I cannot for the life of me remember anymore. Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!