diff --git a/ulib/mem/swap.c b/ulib/mem/swap.c deleted file mode 100644 index d11e503..0000000 --- a/ulib/mem/swap.c +++ /dev/null @@ -1,15 +0,0 @@ -/* -** EPITECH PROJECT, 2024 -** CPoolDay07 -** File description: -** ./u_swap.c -*/ - -void u_swap(int *a, int *b) -{ - int swap; - - swap = *a; - *a = *b; - *b = swap; -} diff --git a/ulib/mem/swap_uint32.c b/ulib/mem/swap_uint32.c deleted file mode 100644 index b1c9c8e..0000000 --- a/ulib/mem/swap_uint32.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -** EPITECH PROJECT, 2025 -** __ -** File description: -** _ -*/ - -int swap_uint32(int src) -{ - return ((src & 0xFF000000) >> 24) | - ((src & 0x00FF0000) >> 8) | - ((src & 0x0000FF00) << 8) | - ((src & 0x000000FF) << 24); -} diff --git a/ulib/str/getnbr.c b/ulib/str/getnbr.c deleted file mode 100644 index a96e25a..0000000 --- a/ulib/str/getnbr.c +++ /dev/null @@ -1,52 +0,0 @@ -/* -** EPITECH PROJECT, 2024 -** B-CPE-100-REN-1-1-cpoolday03-savinien.petitjean -** File description: -** u_getnbr.c -*/ - -long u_pow(int pow) -{ - long r = 1; - - for (long i = 0; i < pow; i++) - r *= 10; - return r; -} - -int u_atoi(char *str, int size, int negativ, int rsize) -{ - long result = 0; - - if (size > 10 || size == 0 || rsize == 0) - return 0; - for (int i = 0; i < size; i++) - result += u_pow(size - i - 1) * (str[i] - '0'); - if (negativ % 2 != 0) - result *= (-1); - if (result > 2147483647 || result < -2147483648) - return 0; - return (int)result; -} - -int u_getnbr(char const *str) -{ - int start = 0; - int end = 0; - int sig = 0; - char nstr[1000000]; - int size = 0; - int rsize = 1; - - for (; str[start] < 48 || str[start] > 57; start++); - end = start + 1; - for (; str[end] >= 48 && str[end] <= 57; end++); - for (int i = 0; i < end; i++) - if (str[i] == '-') - sig++; - for (int i = start; i < end; i++) { - nstr[size] = str[i]; - size++; - } - return u_atoi(nstr, size, sig, rsize); -} diff --git a/ulib/str/revstr.c b/ulib/str/revstr.c deleted file mode 100644 index a950abe..0000000 --- a/ulib/str/revstr.c +++ /dev/null @@ -1,21 +0,0 @@ -/* -** EPITECH PROJECT, 2024 -** B-CPE-100-REN-1-1-cpoolday06-savinien.petitjean -** File description: -** Task 3 -*/ - -#include "u_str.h" - -char *u_revstr(char *str) -{ - int len = u_strlen(str); - char copy; - - for (int i = 0; i < len / 2; i++) { - copy = str[i]; - str[i] = str[len - 1 - i]; - str[len - 1 - i] = copy; - } - return (str); -} diff --git a/ulib/str/strcat.c b/ulib/str/strcat.c deleted file mode 100644 index 59e1058..0000000 --- a/ulib/str/strcat.c +++ /dev/null @@ -1,33 +0,0 @@ -/* -** EPITECH PROJECT, 2023 -** CPoolDay07 -** File description: -** ./u_strcat.c -*/ - -#include - -#include "u_str.h" - -char *u_strcat(char *dest, char const *src) -{ - int i; - int count; - char *res; - - i = 0; - count = 0; - res = malloc(sizeof(*res) * (u_strlen(dest) + u_strlen(src) + 1)); - if (res == NULL) - return NULL; - while (dest[i]) { - res[i] = dest[i]; - i++; - } - while (src[count]) { - res[i + count] = src[count]; - count++; - } - res[i + count] = '\0'; - return (res); -} diff --git a/ulib/str/strlen.c b/ulib/str/strlen.c index a7423db..6ce8a58 100644 --- a/ulib/str/strlen.c +++ b/ulib/str/strlen.c @@ -17,11 +17,3 @@ int u_strlen(char const *str) for (; *p != '\0'; p++); return (p - str); } - -int u_spacelen(char const *str) -{ - char const *p = str; - - for (; !isblank(*p) && *p != '\0'; p++); - return (p - str); -} diff --git a/ulib/str/strncmp.c b/ulib/str/strncmp.c deleted file mode 100644 index 2f06cde..0000000 --- a/ulib/str/strncmp.c +++ /dev/null @@ -1,16 +0,0 @@ -/* -** EPITECH PROJECT, 2024 -** B-CPE-100-REN-1-1-cpoolday06-savinien.petitjean -** File description: -** Task 1 -*/ - -int u_strncmp(char const *s1, char const *s2, int nb) -{ - int i = 0; - - if (nb == 0) - return 0; - for (; s1[i] == s2[i] && s1[i] != '\0' && i < nb - 1; i++); - return s1[i] - s2[i]; -} diff --git a/ulib/str/strncpy.c b/ulib/str/strncpy.c deleted file mode 100644 index 4cfc47c..0000000 --- a/ulib/str/strncpy.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -** EPITECH PROJECT, 2024 -** B-CPE-100-REN-1-1-cpoolday06-savinien.petitjean -** File description: -** Task 2 -*/ - -__attribute__((nonnull(1, 2))) -char *u_strncpy(char *dest, char const *src, int n) -{ - int i = 0; - - for (; i < n && src[i] != '\0'; i++) - dest[i] = src[i]; - if (src[i] == '\0' && i < n) - dest[i] = '\0'; - return dest; -} diff --git a/ulib/str/strstr.c b/ulib/str/strstr.c deleted file mode 100644 index 2439486..0000000 --- a/ulib/str/strstr.c +++ /dev/null @@ -1,22 +0,0 @@ -/* -** EPITECH PROJECT, 2024 -** B-CPE-100-REN-1-1-cpoolday06-savinien.petitjean -** File description: -** Task 2 -*/ - -#include - -#include "u_str.h" - -char *u_strstr(char *str, char const *to_find) -{ - int find_len = u_strlen(to_find); - - if (*to_find == '\0') - return str; - for (; *str != '\0'; str++) - if (!u_strncmp(str, to_find, find_len)) - return str; - return NULL; -}