1
0
Fork 0
forked from len0rd/rockbox

Add mempcpy implementation

A GNU extension that returns dst + size instead of dst. It's a nice
shortcut when copying strings with a known size or back-to-back blocks
and you have to do it often.

May of course be called directly or alternately through
__builtin_mempcpy in some compiler versions.

For ASM on native targets, it is implemented as an alternate entrypoint
to memcpy which adds minimal code and overhead.

Change-Id: I4cbb3483f6df3c1007247fe0a95fd7078737462b
This commit is contained in:
Michael Sevakis 2014-08-06 04:26:52 -04:00
parent 7d1a47cf13
commit 77b3625763
8 changed files with 99 additions and 4 deletions

View file

@ -18,8 +18,8 @@
* KIND, either express or implied.
*
****************************************************************************/
#ifndef STRING_EXTRA_H
#define STRING_EXTRA_H
#include <string.h>
#include "strlcpy.h"
#include "strlcat.h"
@ -27,3 +27,11 @@
#include "strcasestr.h"
#include "strtok_r.h"
#include "memset16.h"
#if defined(WIN32) || defined(APPLICATION)
#ifndef mempcpy
#define mempcpy __builtin_mempcpy
#endif
#endif
#endif /* STRING_EXTRA_H */