x86-64 assembly implementations of some standard C library functions. A 42 school project.
| Function | Prototype |
|---|---|
ft_strlen | int ft_strlen(char *s) |
ft_strcpy | char *ft_strcpy(char *dst, const char *src) |
ft_strcmp | int ft_strcmp(const char *s1, const char *s2) |
ft_write | int ft_write(int fd, const void *buf, size_t count) |
ft_read | int ft_read(int fd, void *buf, size_t count) |
ft_strdup | char *ft_strdup(const char *s) |
| Function | Prototype |
|---|---|
ft_atoi_base | int ft_atoi_base(const char *str, const char *base) |
ft_list_push_front | void ft_list_push_front(t_list **list, void *data) |
ft_list_size | int ft_list_size(t_list *list) |
ft_list_sort | void ft_list_sort(t_list **list, int (*cmp)()) |
ft_list_remove_if | void ft_list_remove_if(t_list **list, void *ref, int (*cmp)(), void (*free_fct)(void *)) |
make
make bonus
# Compile and link the test program
make test
./a.outLink libasm.a against your C program:
#include<stdio.h>intft_strlen(char*s);
char*ft_strdup(constchar*s);
intmain(void)
{
printf("%d\n", ft_strlen("hello")); // 5char*dup=ft_strdup("world");
printf("%s\n", dup); // worldfree(dup);
}gcc main.c libasm.a -o main
./main- NASM (Netwide Assembler)
- GCC
Tested with libasm_test.