blob: 449c75641f02926d0ac13bbc9657231dddfc9753 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* 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 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22#include "../generic/memcopy.h"
23
24/* We override the word-copying macros, partly because misalignment in one
25 pointer isn't cause for a special function, partly because we want to
26 get rid of all the static functions in generic/memcopy.c; these macros
27 are only used in memmove.c since we have arch-specific mempcpy, memcpy and
28 memset. */
29
30#undef OP_T_THRES
31#define OP_T_THRES OPSIZ
32
33#undef WORD_COPY_FWD
34#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
35 do \
36 { \
37 unsigned long enddst_bp = dst_bp + nbytes - (nbytes % OPSIZ); \
38 nbytes_left = (nbytes % OPSIZ); \
39 while (dst_bp < (unsigned long) enddst_bp) \
40 { \
41 op_t x = *(op_t *) src_bp; \
42 src_bp += sizeof x; \
43 *(op_t *) dst_bp = x; \
44 dst_bp += sizeof x; \
45 } \
46 } while (0)
47
48#undef WORD_COPY_BWD
49#define WORD_COPY_BWD(dst_bp, src_bp, nbytes_left, nbytes) \
50 do \
51 { \
52 unsigned long enddst_bp = dst_bp - nbytes + (nbytes % OPSIZ); \
53 nbytes_left = (nbytes % OPSIZ); \
54 while (dst_bp > enddst_bp) \
55 { \
56 op_t x; \
57 src_bp -= sizeof x; \
58 x = *(op_t *) src_bp; \
59 dst_bp -= sizeof x; \
60 *(op_t *) dst_bp = x; \
61 } \
62 } while (0)