feat: ft_bzero
This commit is contained in:
parent
13628b49b8
commit
12b8ab0bbc
3 changed files with 19 additions and 2 deletions
3
Makefile
3
Makefile
|
|
@ -16,7 +16,8 @@ SRCS=$(SRC_DIR)/ft_strlen.asm \
|
|||
$(SRC_DIR)/ft_write.asm \
|
||||
$(SRC_DIR)/ft_read.asm \
|
||||
$(SRC_DIR)/ft_strdup.asm \
|
||||
$(SRC_DIR)/ft_memcpy.asm
|
||||
$(SRC_DIR)/ft_memcpy.asm \
|
||||
$(SRC_DIR)/ft_bzero.asm
|
||||
|
||||
OBJS=$(patsubst $(SRC_DIR)/%.asm,$(OBJ_DIR)/%.o,$(SRCS))
|
||||
DEPS=$(OBJS:.o=.d)
|
||||
|
|
|
|||
16
src/ft_bzero.asm
Normal file
16
src/ft_bzero.asm
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
global ft_bzero
|
||||
section .text
|
||||
|
||||
; rdi: dest
|
||||
; rsi: len
|
||||
ft_bzero:
|
||||
test rsi, rsi
|
||||
je .done
|
||||
|
||||
xor eax, eax
|
||||
mov rcx, rsi
|
||||
cld
|
||||
rep stosb
|
||||
|
||||
.done:
|
||||
ret
|
||||
|
|
@ -13,7 +13,7 @@ ssize_t ft_write(int fildes, const void *buf, size_t nbyte);
|
|||
char *strdup(const char *s);
|
||||
ssize_t ft_read(int fd, void *buf, size_t count);
|
||||
void *ft_memcpy(void *dest, const void *src, size_t n);
|
||||
|
||||
void ft_bzero(void *s, size_t n);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue