-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathft_bzero.c
29 lines (26 loc) · 1.16 KB
/
ft_bzero.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vbrazas <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/29 19:40:48 by vbrazas #+# #+# */
/* Updated: 2018/09/10 16:36:06 by vbrazas ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_bzero(void *s, size_t n)
{
size_t *size_t_s;
unsigned char *uchar_s;
size_t i;
size_t_s = (size_t *)s;
uchar_s = (unsigned char *)s;
i = n - (n % sizeof(size_t));
while (i < n)
uchar_s[i++] = 0;
n /= sizeof(size_t);
while (n)
size_t_s[--n] = 0;
}