]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libc/string/cris/memcopy.h
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libc / string / cris / memcopy.h
1 /* Copyright (C) 2001 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    Modified for use in uClibc (C) 2007 Axis Communications AB.
5    Minimal modifications: include path name and #undef of WORD_COPY_FWD/BWD
6
7    The GNU C Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Library General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
11
12    The GNU C Library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Library General Public License for more details.
16
17    You should have received a copy of the GNU Library General Public
18    License along with the GNU C Library; see the file COPYING.LIB.  If not,
19    see <http://www.gnu.org/licenses/>.  */
20
21 #include "../generic/memcopy.h"
22
23 /* We override the word-copying macros, partly because misalignment in one
24    pointer isn't cause for a special function, partly because we want to
25    get rid of all the static functions in generic/memcopy.c; these macros
26    are only used in memmove.c since we have arch-specific mempcpy, memcpy and
27    memset.  */
28
29 #undef OP_T_THRES
30 #define OP_T_THRES OPSIZ
31
32 #undef WORD_COPY_FWD
33 #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes)              \
34   do                                                                    \
35     {                                                                   \
36       unsigned long enddst_bp = dst_bp + nbytes - (nbytes % OPSIZ);     \
37       nbytes_left = (nbytes % OPSIZ);                                   \
38       while (dst_bp < (unsigned long) enddst_bp)                        \
39         {                                                               \
40           op_t x = *(op_t *) src_bp;                                    \
41           src_bp += sizeof x;                                           \
42           *(op_t *) dst_bp = x;                                         \
43           dst_bp += sizeof x;                                           \
44         }                                                               \
45     } while (0)
46
47 #undef WORD_COPY_BWD
48 #define WORD_COPY_BWD(dst_bp, src_bp, nbytes_left, nbytes)              \
49   do                                                                    \
50     {                                                                   \
51       unsigned long enddst_bp = dst_bp - nbytes + (nbytes % OPSIZ);     \
52       nbytes_left = (nbytes % OPSIZ);                                   \
53       while (dst_bp > enddst_bp)                                        \
54         {                                                               \
55           op_t x;                                                       \
56           src_bp -= sizeof x;                                           \
57           x = *(op_t *) src_bp;                                         \
58           dst_bp -= sizeof x;                                           \
59           *(op_t *) dst_bp = x;                                         \
60         }                                                               \
61     } while (0)