Dave's Brain

Browse - programming tips - win32 fast way to copy a dword

Date: 2010mar8

Q.  What's a quick way to move a doubleword (4 bytes)?
    (eg an IPv4 address)

A.  You could do this:

	memcpy(&to_buffer, &dwFrom, sizeof(DWORD));

But this is faster:

	*((DWORD *)&to_buffer) = dwFrom;
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2010, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.