source: asp3_tinet_ecnl_arm/trunk/musl-1.1.18/src/string/stpcpy.c@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 632 bytes
Line 
1#include <string.h>
2#include <stdint.h>
3#include <limits.h>
4#include "libc.h"
5
6#define ALIGN (sizeof(size_t))
7#define ONES ((size_t)-1/UCHAR_MAX)
8#define HIGHS (ONES * (UCHAR_MAX/2+1))
9#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS)
10
11char *__stpcpy(char *restrict d, const char *restrict s)
12{
13 size_t *wd;
14 const size_t *ws;
15
16 if ((uintptr_t)s % ALIGN == (uintptr_t)d % ALIGN) {
17 for (; (uintptr_t)s % ALIGN; s++, d++)
18 if (!(*d=*s)) return d;
19 wd=(void *)d; ws=(const void *)s;
20 for (; !HASZERO(*ws); *wd++ = *ws++);
21 d=(void *)wd; s=(const void *)ws;
22 }
23 for (; (*d=*s); s++, d++);
24
25 return d;
26}
27
28weak_alias(__stpcpy, stpcpy);
Note: See TracBrowser for help on using the repository browser.