-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use memcpy() instead of memmove() if data doesn't overlap
- Loading branch information
Andrea Guzzo
committed
Apr 13, 2014
1 parent
ed353ca
commit e6ba756
Showing
1 changed file
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e6ba756
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark please :P. I'm of the camp that you should just always use memmove and let libc have the three asm instructions to determine if the blocks overlap and which implementation to dispatch to. Having a single code path is also simpler.
e6ba756
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well they don't overlap there... memmove was used in the previous implementation and I just left it there.
For what it's doing sounds more natural to use memcpy() instead of memmove() ... performances are exactly the same from what I've seen
(AKA: it's irrelevant)