diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-11-10 16:34:46 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-11-10 16:34:46 +0000 |
commit | 52e613351a71a9aa8cf9dcda553e0811968497e8 (patch) | |
tree | 57bc8ad99b79a25acae788f26a6f2b8a4d3789fc /nuttx/libc/string | |
parent | 0f11ac27b9b9dbdde216a700434b7fcdc47e1093 (diff) | |
download | px4-nuttx-52e613351a71a9aa8cf9dcda553e0811968497e8.tar.gz px4-nuttx-52e613351a71a9aa8cf9dcda553e0811968497e8.tar.bz2 px4-nuttx-52e613351a71a9aa8cf9dcda553e0811968497e8.zip |
OK.. I think the directory has been recovered and renamed
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5331 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/libc/string')
38 files changed, 386 insertions, 386 deletions
diff --git a/nuttx/libc/string/Make.defs b/nuttx/libc/string/Make.defs index 191b9ffea..311c8afd2 100644 --- a/nuttx/libc/string/Make.defs +++ b/nuttx/libc/string/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/string/Make.defs +# libc/string/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_checkbase.c b/nuttx/libc/string/lib_checkbase.c index bc79ab2ce..32ae58dca 100644 --- a/nuttx/libc/string/lib_checkbase.c +++ b/nuttx/libc/string/lib_checkbase.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_checkbase.c + * libc/string/lib_checkbase.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_isbasedigit.c b/nuttx/libc/string/lib_isbasedigit.c index a2421bf2a..dff813881 100644 --- a/nuttx/libc/string/lib_isbasedigit.c +++ b/nuttx/libc/string/lib_isbasedigit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_isbasedigit.c + * libc/string/lib_isbasedigit.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_memccpy.c b/nuttx/libc/string/lib_memccpy.c index 1f3dbb52d..1d77f58fe 100644 --- a/nuttx/libc/string/lib_memccpy.c +++ b/nuttx/libc/string/lib_memccpy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_memccpy.c + * libc/string/lib_memccpy.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_memchr.c b/nuttx/libc/string/lib_memchr.c index e0dec8270..0ac609104 100644 --- a/nuttx/libc/string/lib_memchr.c +++ b/nuttx/libc/string/lib_memchr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_memchr.c + * libc/string/lib_memchr.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_memcmp.c b/nuttx/libc/string/lib_memcmp.c index eb2e1fd12..e1722a4d8 100644 --- a/nuttx/libc/string/lib_memcmp.c +++ b/nuttx/libc/string/lib_memcmp.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/string/lib_memcmp.c + * libc/string/lib_memcmp.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_memcpy.c b/nuttx/libc/string/lib_memcpy.c index 3b62edbab..2ebd5beee 100644 --- a/nuttx/libc/string/lib_memcpy.c +++ b/nuttx/libc/string/lib_memcpy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_memcpy.c + * libc/string/lib_memcpy.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_memmove.c b/nuttx/libc/string/lib_memmove.c index 85cb79e17..cbc26fb26 100644 --- a/nuttx/libc/string/lib_memmove.c +++ b/nuttx/libc/string/lib_memmove.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/string/lib_memmove.c + * libc/string/lib_memmove.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_memset.c b/nuttx/libc/string/lib_memset.c index 31c386e92..0b98ebf96 100644 --- a/nuttx/libc/string/lib_memset.c +++ b/nuttx/libc/string/lib_memset.c @@ -1,6 +1,6 @@ /**************************************************************************** - * lib/string/lib_memset.c + * libc/string/lib_memset.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_skipspace.c b/nuttx/libc/string/lib_skipspace.c index b4e6588e5..4b72b1ec3 100644 --- a/nuttx/libc/string/lib_skipspace.c +++ b/nuttx/libc/string/lib_skipspace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_skipspace.c + * libc/string/lib_skipspace.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strcasecmp.c b/nuttx/libc/string/lib_strcasecmp.c index d4aa8cc03..df6f08118 100644 --- a/nuttx/libc/string/lib_strcasecmp.c +++ b/nuttx/libc/string/lib_strcasecmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strcasecmp.c + * libc/string/lib_strcasecmp.c * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strcasestr.c b/nuttx/libc/string/lib_strcasestr.c index 23f0ab57e..5a8d53bee 100644 --- a/nuttx/libc/string/lib_strcasestr.c +++ b/nuttx/libc/string/lib_strcasestr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strstr.c + * libc/string/lib_strstr.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strcat.c b/nuttx/libc/string/lib_strcat.c index 20350fec0..b331d3f1c 100644 --- a/nuttx/libc/string/lib_strcat.c +++ b/nuttx/libc/string/lib_strcat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strcat.c + * libc/string/lib_strcat.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strchr.c b/nuttx/libc/string/lib_strchr.c index d0bd22a0e..e6af56eee 100644 --- a/nuttx/libc/string/lib_strchr.c +++ b/nuttx/libc/string/lib_strchr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strchr.c + * libc/string/lib_strchr.c * * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strcmp.c b/nuttx/libc/string/lib_strcmp.c index 0e3eee890..d4036cd3e 100644 --- a/nuttx/libc/string/lib_strcmp.c +++ b/nuttx/libc/string/lib_strcmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strcmp.c + * libc/string/lib_strcmp.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strcpy.c b/nuttx/libc/string/lib_strcpy.c index e2f70b94e..7a0576f5a 100644 --- a/nuttx/libc/string/lib_strcpy.c +++ b/nuttx/libc/string/lib_strcpy.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string/lib_strcpy.c + * libc/string/lib_strcpy.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strcspn.c b/nuttx/libc/string/lib_strcspn.c index 9da89241c..23e913fad 100644 --- a/nuttx/libc/string/lib_strcspn.c +++ b/nuttx/libc/string/lib_strcspn.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strcspn.c + * libc/string/lib_strcspn.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strdup.c b/nuttx/libc/string/lib_strdup.c index 44a0cbc0d..a5b3a1e8c 100644 --- a/nuttx/libc/string/lib_strdup.c +++ b/nuttx/libc/string/lib_strdup.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string//lib_strdup.c + * libc/string//lib_strdup.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strerror.c b/nuttx/libc/string/lib_strerror.c index 249f695c1..0c7ca28fd 100644 --- a/nuttx/libc/string/lib_strerror.c +++ b/nuttx/libc/string/lib_strerror.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string/lib_strerror.c + * libc/string/lib_strerror.c * * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strlen.c b/nuttx/libc/string/lib_strlen.c index 833305809..6077858e2 100644 --- a/nuttx/libc/string/lib_strlen.c +++ b/nuttx/libc/string/lib_strlen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strlen.c + * libc/string/lib_strlen.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strncasecmp.c b/nuttx/libc/string/lib_strncasecmp.c index be369cf0d..35f701c5e 100644 --- a/nuttx/libc/string/lib_strncasecmp.c +++ b/nuttx/libc/string/lib_strncasecmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strncasecmp.c + * libc/string/lib_strncasecmp.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strncat.c b/nuttx/libc/string/lib_strncat.c index af893e0f9..78c54835e 100644 --- a/nuttx/libc/string/lib_strncat.c +++ b/nuttx/libc/string/lib_strncat.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/string/lib_strncat.c + * libc/string/lib_strncat.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strncmp.c b/nuttx/libc/string/lib_strncmp.c index ce2282024..dd8b57fd0 100644 --- a/nuttx/libc/string/lib_strncmp.c +++ b/nuttx/libc/string/lib_strncmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/lib_strncmp.c + * libc/lib_strncmp.c * * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strncpy.c b/nuttx/libc/string/lib_strncpy.c index 149369d50..8a97aa67b 100644 --- a/nuttx/libc/string/lib_strncpy.c +++ b/nuttx/libc/string/lib_strncpy.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/string/lib_strncpy.c + * libc/string/lib_strncpy.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strndup.c b/nuttx/libc/string/lib_strndup.c index ffaf892ea..524e09754 100644 --- a/nuttx/libc/string/lib_strndup.c +++ b/nuttx/libc/string/lib_strndup.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string//lib_strndup.c + * libc/string//lib_strndup.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strnlen.c b/nuttx/libc/string/lib_strnlen.c index 2b64fe984..9bc3064cb 100644 --- a/nuttx/libc/string/lib_strnlen.c +++ b/nuttx/libc/string/lib_strnlen.c @@ -1,12 +1,12 @@ /**************************************************************************** - * lib/string/lib_strnlen.c + * libc/string/lib_strnlen.c * * This file is part of NuttX, contributed by Michael Hrabanek * * Copyright (C) 2010 Gregory Nutt. All rights reserved. * Author: Michael Hrabanek * - * Derives from the file lib/lib_strlen.c: + * Derives from the file libc/lib_strlen.c: * * Copyright (C) 2007, 2008, 2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strpbrk.c b/nuttx/libc/string/lib_strpbrk.c index 02e2ea2c7..ef9b0f3e9 100644 --- a/nuttx/libc/string/lib_strpbrk.c +++ b/nuttx/libc/string/lib_strpbrk.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strpbrk.c + * libc/string/lib_strpbrk.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strrchr.c b/nuttx/libc/string/lib_strrchr.c index 91243ce58..08575c82b 100644 --- a/nuttx/libc/string/lib_strrchr.c +++ b/nuttx/libc/string/lib_strrchr.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string/lib_strrchr.c + * libc/string/lib_strrchr.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strspn.c b/nuttx/libc/string/lib_strspn.c index e7b5ea0a5..6894b2b9d 100644 --- a/nuttx/libc/string/lib_strspn.c +++ b/nuttx/libc/string/lib_strspn.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strspn.c + * libc/string/lib_strspn.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strstr.c b/nuttx/libc/string/lib_strstr.c index b8c896fa2..02f4809d2 100644 --- a/nuttx/libc/string/lib_strstr.c +++ b/nuttx/libc/string/lib_strstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strstr.c + * libc/string/lib_strstr.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strtod.c b/nuttx/libc/string/lib_strtod.c index 8fecd4571..58dfd6a29 100644 --- a/nuttx/libc/string/lib_strtod.c +++ b/nuttx/libc/string/lib_strtod.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtod.c + * libc/string/lib_strtod.c * Convert string to double * * Copyright (C) 2002 Michael Ringgaard. All rights reserved. diff --git a/nuttx/libc/string/lib_strtok.c b/nuttx/libc/string/lib_strtok.c index c40993135..85d6597d7 100644 --- a/nuttx/libc/string/lib_strtok.c +++ b/nuttx/libc/string/lib_strtok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtok.c + * libc/string/lib_strtok.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strtokr.c b/nuttx/libc/string/lib_strtokr.c index 1c571b6ae..c7845be64 100644 --- a/nuttx/libc/string/lib_strtokr.c +++ b/nuttx/libc/string/lib_strtokr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtokr.c + * libc/string/lib_strtokr.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strtol.c b/nuttx/libc/string/lib_strtol.c index c17d87e63..6ac0d6827 100644 --- a/nuttx/libc/string/lib_strtol.c +++ b/nuttx/libc/string/lib_strtol.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtol.c + * libc/string/lib_strtol.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strtoll.c b/nuttx/libc/string/lib_strtoll.c index 242e025c0..99fba08eb 100644 --- a/nuttx/libc/string/lib_strtoll.c +++ b/nuttx/libc/string/lib_strtoll.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtoll.c + * libc/string/lib_strtoll.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strtoul.c b/nuttx/libc/string/lib_strtoul.c index b0d2d090e..8f27ae3f2 100644 --- a/nuttx/libc/string/lib_strtoul.c +++ b/nuttx/libc/string/lib_strtoul.c @@ -1,5 +1,5 @@ /**************************************************************************** - * /lib/string/lib_strtoul.c + * /libc/string/lib_strtoul.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_strtoull.c b/nuttx/libc/string/lib_strtoull.c index 6567457c0..4808114af 100644 --- a/nuttx/libc/string/lib_strtoull.c +++ b/nuttx/libc/string/lib_strtoull.c @@ -1,5 +1,5 @@ /**************************************************************************** - * /lib/string/lib_strtoull.c + * /libc/string/lib_strtoull.c * * Copyright (C) 2009, 2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/nuttx/libc/string/lib_vikmemcpy.c b/nuttx/libc/string/lib_vikmemcpy.c index b50942aaa..28bf4a4ce 100644 --- a/nuttx/libc/string/lib_vikmemcpy.c +++ b/nuttx/libc/string/lib_vikmemcpy.c @@ -1,348 +1,348 @@ -/****************************************************************************
- * File: lib/string/lib_vikmemcpy.c
- *
- * This is version of the optimized memcpy by Daniel Vik, adapted to the
- * NuttX environment.
- *
- * Copyright (C) 1999-2010 Daniel Vik
- *
- * Adaptations include:
- * - File name change
- * - Use of types defined in stdint.h
- * - Integration with the NuttX configuration system
- * - Other cosmetic changes for consistency with NuttX coding standards
- *
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event will the authors be held liable for any
- * damages arising from the use of this software.
- * Permission is granted to anyone to use this software for any
- * purpose, including commercial applications, and to alter it and
- * redistribute it freely, subject to the following restrictions:
- *
- * 1. The origin of this software must not be misrepresented; you
- * must not claim that you wrote the original software. If you
- * use this software in a product, an acknowledgment in the
- * use this software in a product, an acknowledgment in the
- * product documentation would be appreciated but is not
- * required.
- *
- * 2. Altered source versions must be plainly marked as such, and
- * must not be misrepresented as being the original software.
- *
- * 3. This notice may not be removed or altered from any source
- * distribution.
- *
- * Description: Implementation of the standard library function memcpy.
- * This implementation of memcpy() is ANSI-C89 compatible.
- *
- * The following configuration options can be set:
- *
- * CONFIG_ENDIAN_BIG
- * Uses processor with big endian addressing. Default is little endian.
- *
- * CONFIG_MEMCPY_PRE_INC_PTRS
- * Use pre increment of pointers. Default is post increment of pointers.
- *
- * CONFIG_MEMCPY_INDEXED_COPY
- * Copying data using array indexing. Using this option, disables the
- * CONFIG_MEMCPY_PRE_INC_PTRS option.
- *
- * CONFIG_MEMCPY_64BIT - Compiles memcpy for 64 bit architectures
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Configuration definitions.
- ****************************************************************************/
-
-#define CONFIG_MEMCPY_INDEXED_COPY
-
-/********************************************************************
- * Included Files
- *******************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/compiler.h>
-
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-
-/********************************************************************
- * Pre-processor Definitions
- *******************************************************************/
-
-/* Can't support CONFIG_MEMCPY_64BIT if the platform does not have 64-bit
- * integer types.
- */
-
-#ifndef CONFIG_HAVE_LONG_LONG
-# undef CONFIG_MEMCPY_64BIT
-#endif
-
-/* Remove definitions when CONFIG_MEMCPY_INDEXED_COPY is defined */
-
-#if defined (CONFIG_MEMCPY_INDEXED_COPY)
-# if defined (CONFIG_MEMCPY_PRE_INC_PTRS)
-# undef CONFIG_MEMCPY_PRE_INC_PTRS
-# endif /* CONFIG_MEMCPY_PRE_INC_PTRS */
-#endif /* CONFIG_MEMCPY_INDEXED_COPY */
-
-/* Definitions for pre and post increment of pointers */
-
-#if defined (CONFIG_MEMCPY_PRE_INC_PTRS)
-
-# define START_VAL(x) (x)--
-# define INC_VAL(x) *++(x)
-# define CAST_TO_U8(p, o) ((uint8_t*)p + o + TYPE_WIDTH)
-# define WHILE_DEST_BREAK (TYPE_WIDTH - 1)
-# define PRE_LOOP_ADJUST - (TYPE_WIDTH - 1)
-# define PRE_SWITCH_ADJUST + 1
-
-#else /* CONFIG_MEMCPY_PRE_INC_PTRS */
-
-# define START_VAL(x)
-# define INC_VAL(x) *(x)++
-# define CAST_TO_U8(p, o) ((uint8_t*)p + o)
-# define WHILE_DEST_BREAK 0
-# define PRE_LOOP_ADJUST
-# define PRE_SWITCH_ADJUST
-
-#endif /* CONFIG_MEMCPY_PRE_INC_PTRS */
-
-/* Definitions for endian-ness */
-
-#ifdef CONFIG_ENDIAN_BIG
-
-# define SHL <<
-# define SHR >>
-
-#else /* CONFIG_ENDIAN_BIG */
-
-# define SHL >>
-# define SHR <<
-
-#endif /* CONFIG_ENDIAN_BIG */
-
-/********************************************************************
- * Macros for copying words of different alignment.
- * Uses incremening pointers.
- *******************************************************************/
-
-#define CP_INCR() \
-{ \
- INC_VAL(dstN) = INC_VAL(srcN); \
-}
-
-#define CP_INCR_SH(shl, shr) \
-{ \
- dstWord = srcWord SHL shl; \
- srcWord = INC_VAL(srcN); \
- dstWord |= srcWord SHR shr; \
- INC_VAL(dstN) = dstWord; \
-}
-
-/********************************************************************
- * Macros for copying words of different alignment.
- * Uses array indexes.
- *******************************************************************/
-
-#define CP_INDEX(idx) \
-{ \
- dstN[idx] = srcN[idx]; \
-}
-
-#define CP_INDEX_SH(x, shl, shr) \
-{ \
- dstWord = srcWord SHL shl; \
- srcWord = srcN[x]; \
- dstWord |= srcWord SHR shr; \
- dstN[x] = dstWord; \
-}
-
-/********************************************************************
- * Macros for copying words of different alignment.
- * Uses incremening pointers or array indexes depending on
- * configuration.
- *******************************************************************/
-
-#if defined (CONFIG_MEMCPY_INDEXED_COPY)
-
-# define CP(idx) CP_INDEX(idx)
-# define CP_SH(idx, shl, shr) CP_INDEX_SH(idx, shl, shr)
-
-# define INC_INDEX(p, o) ((p) += (o))
-
-#else /* CONFIG_MEMCPY_INDEXED_COPY */
-
-# define CP(idx) CP_INCR()
-# define CP_SH(idx, shl, shr) CP_INCR_SH(shl, shr)
-
-# define INC_INDEX(p, o)
-
-#endif /* CONFIG_MEMCPY_INDEXED_COPY */
-
-#define COPY_REMAINING(count) \
-{ \
- START_VAL(dst8); \
- START_VAL(src8); \
- \
- switch (count) \
- { \
- case 7: INC_VAL(dst8) = INC_VAL(src8); \
- case 6: INC_VAL(dst8) = INC_VAL(src8); \
- case 5: INC_VAL(dst8) = INC_VAL(src8); \
- case 4: INC_VAL(dst8) = INC_VAL(src8); \
- case 3: INC_VAL(dst8) = INC_VAL(src8); \
- case 2: INC_VAL(dst8) = INC_VAL(src8); \
- case 1: INC_VAL(dst8) = INC_VAL(src8); \
- case 0: \
- default: break; \
- } \
-}
-
-#define COPY_NO_SHIFT() \
-{ \
- UIntN* dstN = (UIntN*)(dst8 PRE_LOOP_ADJUST); \
- UIntN* srcN = (UIntN*)(src8 PRE_LOOP_ADJUST); \
- size_t length = count / TYPE_WIDTH; \
- \
- while (length & 7) \
- { \
- CP_INCR(); \
- length--; \
- } \
- \
- length /= 8; \
- \
- while (length--) \
- { \
- CP(0); \
- CP(1); \
- CP(2); \
- CP(3); \
- CP(4); \
- CP(5); \
- CP(6); \
- CP(7); \
- \
- INC_INDEX(dstN, 8); \
- INC_INDEX(srcN, 8); \
- } \
- \
- src8 = CAST_TO_U8(srcN, 0); \
- dst8 = CAST_TO_U8(dstN, 0); \
- \
- COPY_REMAINING(count & (TYPE_WIDTH - 1)); \
- \
- return dest; \
-}
-
-#define COPY_SHIFT(shift) \
-{ \
- UIntN* dstN = (UIntN*)((((UIntN)dst8) PRE_LOOP_ADJUST) & \
- ~(TYPE_WIDTH - 1)); \
- UIntN* srcN = (UIntN*)((((UIntN)src8) PRE_LOOP_ADJUST) & \
- ~(TYPE_WIDTH - 1)); \
- size_t length = count / TYPE_WIDTH; \
- UIntN srcWord = INC_VAL(srcN); \
- UIntN dstWord; \
- \
- while (length & 7) \
- { \
- CP_INCR_SH(8 * shift, 8 * (TYPE_WIDTH - shift)); \
- length--; \
- } \
- \
- length /= 8; \
- \
- while (length--) \
- { \
- CP_SH(0, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(1, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(2, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(3, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(4, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(5, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(6, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- CP_SH(7, 8 * shift, 8 * (TYPE_WIDTH - shift)); \
- \
- INC_INDEX(dstN, 8); \
- INC_INDEX(srcN, 8); \
- } \
- \
- src8 = CAST_TO_U8(srcN, (shift - TYPE_WIDTH)); \
- dst8 = CAST_TO_U8(dstN, 0); \
- \
- COPY_REMAINING(count & (TYPE_WIDTH - 1)); \
- \
- return dest; \
-}
-
-/********************************************************************
- * Type Definitions
- *******************************************************************/
-
-#ifdef CONFIG_MEMCPY_64BIT
-typedef uint64_t UIntN;
-# define TYPE_WIDTH 8L
-#else
-typedef uint32_t UIntN;
-# define TYPE_WIDTH 4L
-#endif
-
-/********************************************************************
- * Public Functions
- *******************************************************************/
-/********************************************************************
- * Name: memcpy
- *
- * Description:
- * Copies count bytes from src to dest. No overlap check is performed.
- *
- * Input Parameters:
- * dest - pointer to destination buffer
- * src - pointer to source buffer
- * count - number of bytes to copy
- *
- * Returned Value:
- * A pointer to destination buffer
- *
- *******************************************************************/
-
-void *memcpy(void *dest, const void *src, size_t count)
-{
- uint8_t *dst8 = (uint8_t*)dest;
- uint8_t *src8 = (uint8_t*)src;
-
- if (count < 8)
- {
- COPY_REMAINING(count);
- return dest;
- }
-
- START_VAL(dst8);
- START_VAL(src8);
-
- while (((UIntN)dst8 & (TYPE_WIDTH - 1)) != WHILE_DEST_BREAK)
- {
- INC_VAL(dst8) = INC_VAL(src8);
- count--;
- }
-
- switch ((((UIntN)src8) PRE_SWITCH_ADJUST) & (TYPE_WIDTH - 1))
- {
- case 0: COPY_NO_SHIFT(); break;
- case 1: COPY_SHIFT(1); break;
- case 2: COPY_SHIFT(2); break;
- case 3: COPY_SHIFT(3); break;
-#if TYPE_WIDTH > 4
- case 4: COPY_SHIFT(4); break;
- case 5: COPY_SHIFT(5); break;
- case 6: COPY_SHIFT(6); break;
- case 7: COPY_SHIFT(7); break;
-#endif
- }
-
- return dest;
-}
+/**************************************************************************** + * File: libc/string/lib_vikmemcpy.c + * + * This is version of the optimized memcpy by Daniel Vik, adapted to the + * NuttX environment. + * + * Copyright (C) 1999-2010 Daniel Vik + * + * Adaptations include: + * - File name change + * - Use of types defined in stdint.h + * - Integration with the NuttX configuration system + * - Other cosmetic changes for consistency with NuttX coding standards + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you + * use this software in a product, an acknowledgment in the + * use this software in a product, an acknowledgment in the + * product documentation would be appreciated but is not + * required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + * Description: Implementation of the standard library function memcpy. + * This implementation of memcpy() is ANSI-C89 compatible. + * + * The following configuration options can be set: + * + * CONFIG_ENDIAN_BIG + * Uses processor with big endian addressing. Default is little endian. + * + * CONFIG_MEMCPY_PRE_INC_PTRS + * Use pre increment of pointers. Default is post increment of pointers. + * + * CONFIG_MEMCPY_INDEXED_COPY + * Copying data using array indexing. Using this option, disables the + * CONFIG_MEMCPY_PRE_INC_PTRS option. + * + * CONFIG_MEMCPY_64BIT - Compiles memcpy for 64 bit architectures + * + ****************************************************************************/ + +/**************************************************************************** + * Configuration definitions. + ****************************************************************************/ + +#define CONFIG_MEMCPY_INDEXED_COPY + +/******************************************************************** + * Included Files + *******************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/compiler.h> + +#include <stddef.h> +#include <stdint.h> +#include <string.h> + +/******************************************************************** + * Pre-processor Definitions + *******************************************************************/ + +/* Can't support CONFIG_MEMCPY_64BIT if the platform does not have 64-bit + * integer types. + */ + +#ifndef CONFIG_HAVE_LONG_LONG +# undef CONFIG_MEMCPY_64BIT +#endif + +/* Remove definitions when CONFIG_MEMCPY_INDEXED_COPY is defined */ + +#if defined (CONFIG_MEMCPY_INDEXED_COPY) +# if defined (CONFIG_MEMCPY_PRE_INC_PTRS) +# undef CONFIG_MEMCPY_PRE_INC_PTRS +# endif /* CONFIG_MEMCPY_PRE_INC_PTRS */ +#endif /* CONFIG_MEMCPY_INDEXED_COPY */ + +/* Definitions for pre and post increment of pointers */ + +#if defined (CONFIG_MEMCPY_PRE_INC_PTRS) + +# define START_VAL(x) (x)-- +# define INC_VAL(x) *++(x) +# define CAST_TO_U8(p, o) ((uint8_t*)p + o + TYPE_WIDTH) +# define WHILE_DEST_BREAK (TYPE_WIDTH - 1) +# define PRE_LOOP_ADJUST - (TYPE_WIDTH - 1) +# define PRE_SWITCH_ADJUST + 1 + +#else /* CONFIG_MEMCPY_PRE_INC_PTRS */ + +# define START_VAL(x) +# define INC_VAL(x) *(x)++ +# define CAST_TO_U8(p, o) ((uint8_t*)p + o) +# define WHILE_DEST_BREAK 0 +# define PRE_LOOP_ADJUST +# define PRE_SWITCH_ADJUST + +#endif /* CONFIG_MEMCPY_PRE_INC_PTRS */ + +/* Definitions for endian-ness */ + +#ifdef CONFIG_ENDIAN_BIG + +# define SHL << +# define SHR >> + +#else /* CONFIG_ENDIAN_BIG */ + +# define SHL >> +# define SHR << + +#endif /* CONFIG_ENDIAN_BIG */ + +/******************************************************************** + * Macros for copying words of different alignment. + * Uses incremening pointers. + *******************************************************************/ + +#define CP_INCR() \ +{ \ + INC_VAL(dstN) = INC_VAL(srcN); \ +} + +#define CP_INCR_SH(shl, shr) \ +{ \ + dstWord = srcWord SHL shl; \ + srcWord = INC_VAL(srcN); \ + dstWord |= srcWord SHR shr; \ + INC_VAL(dstN) = dstWord; \ +} + +/******************************************************************** + * Macros for copying words of different alignment. + * Uses array indexes. + *******************************************************************/ + +#define CP_INDEX(idx) \ +{ \ + dstN[idx] = srcN[idx]; \ +} + +#define CP_INDEX_SH(x, shl, shr) \ +{ \ + dstWord = srcWord SHL shl; \ + srcWord = srcN[x]; \ + dstWord |= srcWord SHR shr; \ + dstN[x] = dstWord; \ +} + +/******************************************************************** + * Macros for copying words of different alignment. + * Uses incremening pointers or array indexes depending on + * configuration. + *******************************************************************/ + +#if defined (CONFIG_MEMCPY_INDEXED_COPY) + +# define CP(idx) CP_INDEX(idx) +# define CP_SH(idx, shl, shr) CP_INDEX_SH(idx, shl, shr) + +# define INC_INDEX(p, o) ((p) += (o)) + +#else /* CONFIG_MEMCPY_INDEXED_COPY */ + +# define CP(idx) CP_INCR() +# define CP_SH(idx, shl, shr) CP_INCR_SH(shl, shr) + +# define INC_INDEX(p, o) + +#endif /* CONFIG_MEMCPY_INDEXED_COPY */ + +#define COPY_REMAINING(count) \ +{ \ + START_VAL(dst8); \ + START_VAL(src8); \ + \ + switch (count) \ + { \ + case 7: INC_VAL(dst8) = INC_VAL(src8); \ + case 6: INC_VAL(dst8) = INC_VAL(src8); \ + case 5: INC_VAL(dst8) = INC_VAL(src8); \ + case 4: INC_VAL(dst8) = INC_VAL(src8); \ + case 3: INC_VAL(dst8) = INC_VAL(src8); \ + case 2: INC_VAL(dst8) = INC_VAL(src8); \ + case 1: INC_VAL(dst8) = INC_VAL(src8); \ + case 0: \ + default: break; \ + } \ +} + +#define COPY_NO_SHIFT() \ +{ \ + UIntN* dstN = (UIntN*)(dst8 PRE_LOOP_ADJUST); \ + UIntN* srcN = (UIntN*)(src8 PRE_LOOP_ADJUST); \ + size_t length = count / TYPE_WIDTH; \ + \ + while (length & 7) \ + { \ + CP_INCR(); \ + length--; \ + } \ + \ + length /= 8; \ + \ + while (length--) \ + { \ + CP(0); \ + CP(1); \ + CP(2); \ + CP(3); \ + CP(4); \ + CP(5); \ + CP(6); \ + CP(7); \ + \ + INC_INDEX(dstN, 8); \ + INC_INDEX(srcN, 8); \ + } \ + \ + src8 = CAST_TO_U8(srcN, 0); \ + dst8 = CAST_TO_U8(dstN, 0); \ + \ + COPY_REMAINING(count & (TYPE_WIDTH - 1)); \ + \ + return dest; \ +} + +#define COPY_SHIFT(shift) \ +{ \ + UIntN* dstN = (UIntN*)((((UIntN)dst8) PRE_LOOP_ADJUST) & \ + ~(TYPE_WIDTH - 1)); \ + UIntN* srcN = (UIntN*)((((UIntN)src8) PRE_LOOP_ADJUST) & \ + ~(TYPE_WIDTH - 1)); \ + size_t length = count / TYPE_WIDTH; \ + UIntN srcWord = INC_VAL(srcN); \ + UIntN dstWord; \ + \ + while (length & 7) \ + { \ + CP_INCR_SH(8 * shift, 8 * (TYPE_WIDTH - shift)); \ + length--; \ + } \ + \ + length /= 8; \ + \ + while (length--) \ + { \ + CP_SH(0, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(1, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(2, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(3, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(4, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(5, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(6, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(7, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + \ + INC_INDEX(dstN, 8); \ + INC_INDEX(srcN, 8); \ + } \ + \ + src8 = CAST_TO_U8(srcN, (shift - TYPE_WIDTH)); \ + dst8 = CAST_TO_U8(dstN, 0); \ + \ + COPY_REMAINING(count & (TYPE_WIDTH - 1)); \ + \ + return dest; \ +} + +/******************************************************************** + * Type Definitions + *******************************************************************/ + +#ifdef CONFIG_MEMCPY_64BIT +typedef uint64_t UIntN; +# define TYPE_WIDTH 8L +#else +typedef uint32_t UIntN; +# define TYPE_WIDTH 4L +#endif + +/******************************************************************** + * Public Functions + *******************************************************************/ +/******************************************************************** + * Name: memcpy + * + * Description: + * Copies count bytes from src to dest. No overlap check is performed. + * + * Input Parameters: + * dest - pointer to destination buffer + * src - pointer to source buffer + * count - number of bytes to copy + * + * Returned Value: + * A pointer to destination buffer + * + *******************************************************************/ + +void *memcpy(void *dest, const void *src, size_t count) +{ + uint8_t *dst8 = (uint8_t*)dest; + uint8_t *src8 = (uint8_t*)src; + + if (count < 8) + { + COPY_REMAINING(count); + return dest; + } + + START_VAL(dst8); + START_VAL(src8); + + while (((UIntN)dst8 & (TYPE_WIDTH - 1)) != WHILE_DEST_BREAK) + { + INC_VAL(dst8) = INC_VAL(src8); + count--; + } + + switch ((((UIntN)src8) PRE_SWITCH_ADJUST) & (TYPE_WIDTH - 1)) + { + case 0: COPY_NO_SHIFT(); break; + case 1: COPY_SHIFT(1); break; + case 2: COPY_SHIFT(2); break; + case 3: COPY_SHIFT(3); break; +#if TYPE_WIDTH > 4 + case 4: COPY_SHIFT(4); break; + case 5: COPY_SHIFT(5); break; + case 6: COPY_SHIFT(6); break; + case 7: COPY_SHIFT(7); break; +#endif + } + + return dest; +} |