/* Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
/* Implements the functions
char * [r3] strncpy (char *dst [r3], const char *src [r4], size_t n [r5])
AND
char * [r3] stpncpy (char *dst [r3], const char *src [r4], size_t n [r5])
The algorithm is as follows:
> if src and dest are 8 byte aligned, perform double word copy
else
> copy byte by byte on unaligned addresses.
The aligned comparison are made using cmpb instructions. */
/* The focus on optimization for performance improvements are as follows:
1. data alignment [gain from aligned memory access on read/write]
2. POWER7 gains performance <