Dave’s Brain
Home
Search
Browse
Recent
Keywords
Other sites
Feedback
Sign in
Random
Crawlers
Programming Tips
- What's a quick way to move a doubleword (4 bytes)?
Date:
2010mar8
OS:
Windows
Language:
C/C++
Keywords:
copy
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
;