-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Sep 26, 2014
1 parent
4d415c6
commit d8443b8
Showing
97 changed files
with
160 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include <unistd.h> | ||
#include "libft.h" | ||
|
||
//TODO: width specifier,fill char | ||
|
||
static int ft_printradix(double nb, int prec) | ||
{ | ||
char digit; | ||
int size; | ||
|
||
size = prec + 1; | ||
write(1, ".", 1); | ||
while (prec > 0) | ||
{ | ||
if (nb != 0) | ||
{ | ||
nb *= 10; | ||
digit = (char)nb; | ||
nb -= (double)digit; | ||
ft_putchar(digit + '0'); | ||
} | ||
else | ||
ft_putchar('0'); | ||
--prec; | ||
} | ||
return (size); | ||
} | ||
|
||
int ft_putdouble(double nb, int prec) | ||
{ | ||
int size; | ||
double mask; | ||
char digit; | ||
|
||
size = 0; | ||
mask = 1.0; | ||
if (nb < 0) | ||
{ | ||
nb = 0 - nb; | ||
write(1, "-", 1); | ||
++size; | ||
} | ||
while (nb / mask > 10.0) | ||
mask *= 10.0; | ||
while (mask >= 1.0) | ||
{ | ||
digit = (char)(nb / mask); | ||
++size; | ||
nb -= mask * (double)digit; | ||
mask /= 10.0; | ||
ft_putchar(digit + '0'); | ||
} | ||
if (prec > 0) | ||
size += ft_printradix(nb, prec); | ||
return (size); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "libft.h" | ||
#include <limits.h> | ||
|
||
int ft_putnbr_ll(long long nbr) | ||
{ | ||
char digit; | ||
unsigned long size; | ||
|
||
// long max | ||
if (nbr < 0) | ||
{ | ||
ft_putchar('-'); | ||
nbr = 0 - nbr; | ||
} | ||
digit = (char)(nbr % 10); | ||
if (nbr >= 10) | ||
size = ft_putnbr_ll(nbr / 10); | ||
else | ||
size = 1; | ||
ft_putchar('0' + digit); | ||
return (size); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_putnbroct.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: tseguier <marvin@42.fr> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2014/08/01 04:33:12 by tseguier #+# #+# */ | ||
/* Updated: 2014/08/01 04:35:47 by tseguier ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
static const char *g_octbase = "01234567"; | ||
|
||
void ft_putnbr_oct(unsigned long long nb, unsigned int len) | ||
{ | ||
char nb_act; | ||
|
||
nb_act = nb % 8; | ||
if (nb >= 8) | ||
ft_putnbr_oct(nb / 8, len > 0 ? len - 1 : 0); | ||
else if (len > 0) | ||
{ | ||
while (--len > 0) | ||
ft_putchar('0'); | ||
} | ||
ft_putchar(g_octbase[(int)nb_act]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "libft.h" | ||
#include <limits.h> | ||
|
||
int ft_putnbr_ull(unsigned long long nbr) | ||
{ | ||
char digit; | ||
unsigned long size; | ||
|
||
digit = (char)(nbr % 10); | ||
if (nbr >= 10) | ||
size = ft_putnbr_ull(nbr / 10); | ||
else | ||
size = 1; | ||
ft_putchar('0' + digit); | ||
return (size); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters