mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 14:53:35 +08:00
Add memccpy{}
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4990 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* lib/string/lib_memcpy.c
|
||||
*
|
||||
* Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -31,29 +31,33 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Global Functions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: memcpy
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_MEMCPY
|
||||
void *memcpy(void *dest, const void *src, size_t n)
|
||||
FAR void *memcpy(FAR void *dest, FAR const void *src, size_t n)
|
||||
{
|
||||
unsigned char *pout = (unsigned char*)dest;
|
||||
unsigned char *pin = (unsigned char*)src;
|
||||
FAR unsigned char *pout = (FAR unsigned char*)dest;
|
||||
FAR unsigned char *pin = (FAR unsigned char*)src;
|
||||
while (n-- > 0) *pout++ = *pin++;
|
||||
return dest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user