sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
stpcpy.c
1
#define SYSCLIB_DISABLE_BUILTINS
2
#include <
sysclib.h
>
3
#include <stdint.h>
4
#include <limits.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
11
char
*__stpcpy(
char
*restrict d,
const
char
*restrict s)
12
{
13
#ifdef __GNUC__
14
typedef
size_t
__attribute__
((__may_alias__)) word;
15
// cppcheck-suppress variableScope
16
word *wd;
17
// cppcheck-suppress variableScope
18
const
word *ws;
19
if
((uintptr_t)s % ALIGN == (uintptr_t)d % ALIGN) {
20
for
(; (uintptr_t)s % ALIGN; s++, d++)
21
if
(!(*d=*s))
return
d;
22
wd=(
void
*)d; ws=(
const
void
*)s;
23
for
(; !HASZERO(*ws); *wd++ = *ws++);
24
d=(
void
*)wd; s=(
const
void
*)ws;
25
}
26
#endif
27
for
(; (*d=*s); s++, d++);
28
29
return
d;
30
}
__attribute__
Definition
gif_registers.h:40
sysclib.h
core
sysclib
src
musl
string
stpcpy.c
Generated by
1.18.0