aboutsummaryrefslogtreecommitdiffstats
path: root/lib.c
blob: fcf5f69f1d9b43bd3decda0d743278733491b29d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * lib.c - Standard utilities that might be needed by GCC
 *
 * Copyright (C) 2015 ARM Limited. All rights reserved.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE.txt file.
 */

#include <stddef.h>

void *memcpy(void *dest, const void *src, size_t n)
{
	int i;
	char *cdest = dest;
	const char *csrc = src;

	for (i = 0; i < n; i++)
		cdest[i] = csrc[i];

	return dest;
}

void *memset(void *s, int c, size_t n)
{
	int i;
	char *cs = s;

	for (i = 0; i < n; i++)
		cs[i] = c;

	return s;
}

/* TODO: memmove and memcmp could also be called */