Advertisement

memory alignment question.

Started by January 31, 2000 10:54 PM
0 comments, last by blazter2 24 years, 10 months ago
Why do I have to check the memory address of destination, source and the count alignment to 4 boundary, to do a dword memcpy? Why can''t I just check for the count alignment to 4 ? I don''t really understand why the memory address can mess up with the copy.
Thanks,blazter

You don''t necessarily have to check. However,
I believe it''s the case that if you call such
a function with unaligned arguments, it will have
to two reads/writes per dword copied (one for
each portion of the DWORD that falls on each
side of the dword alignment) which will actually
turn out to be much slower than just copying a
byte at a time.

This topic is closed to new replies.

Advertisement