-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_utf8_count_bytes.c
More file actions
26 lines (24 loc) · 1.09 KB
/
ft_utf8_count_bytes.c
File metadata and controls
26 lines (24 loc) · 1.09 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_utf8_count_bytes.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mbalon-s <mbalon-s@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/28 19:32:25 by mbalon-s #+# #+# */
/* Updated: 2019/02/28 19:53:32 by mbalon-s ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
int ft_utf8_count_bytes(unsigned int c)
{
if (c <= 0x7F)
return (1);
else if (c <= 0x7FF)
return (2);
else if (c <= 0xFFFF)
return (3);
else if (c <= 0x10FFFF)
return (4);
return (0);
}