//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2019, Pete Batard. All rights reserved.\r
+// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
//\r
// SPDX-License-Identifier: BSD-2-Clause-Patent\r
//\r
unsigned char const *t1 = s1;\r
unsigned char const *t2 = s2;\r
\r
- while (n--) {\r
+ while (n-- != 0) {\r
if (*t1 != *t2)\r
return (int)*t1 - (int)*t2;\r
t1++;\r
//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
+// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
//\r
// SPDX-License-Identifier: BSD-2-Clause-Patent\r
//\r
unsigned char *d = dest;\r
unsigned char const *s = src;\r
\r
- while (n--)\r
+ while (n-- != 0) {\r
*d++ = *s++;\r
+ }\r
}\r
\r
void *memcpy(void *dest, const void *src, size_t n)\r
//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2017, Pete Batard. All rights reserved.<BR>\r
+// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
//\r
// SPDX-License-Identifier: BSD-2-Clause-Patent\r
//\r
unsigned char *d = dest;\r
unsigned char const *s = src;\r
\r
- while (n--)\r
+ while (n-- != 0) {\r
*d++ = *s++;\r
+ }\r
\r
return dest;\r
}\r
//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2019, Pete Batard. All rights reserved.\r
+// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
//\r
// SPDX-License-Identifier: BSD-2-Clause-Patent\r
//\r
unsigned char const *s = src;\r
\r
if (d < s) {\r
- while (n--)\r
+ while (n-- != 0) {\r
*d++ = *s++;\r
+ }\r
} else {\r
d += n;\r
s += n;\r
- while (n--)\r
+ while (n-- != 0) {\r
*--d = *--s;\r
+ }\r
}\r
\r
return dest;\r
//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
+// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
//\r
// SPDX-License-Identifier: BSD-2-Clause-Patent\r
//\r
{\r
unsigned char *d = s;\r
\r
- while (n--)\r
+ while (n-- != 0) {\r
*d++ = c;\r
+ }\r
\r
return s;\r
}\r
//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2017, Pete Batard. All rights reserved.<BR>\r
+// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
//\r
// SPDX-License-Identifier: BSD-2-Clause-Patent\r
//\r
{\r
unsigned char *d = s;\r
\r
- while (n--)\r
+ while (n-- != 0) {\r
*d++ = (unsigned char)c;\r
+ }\r
\r
return s;\r
}\r