Похожие чаты

So, for the whole day, I've been rewriting many of

the default standard lib funtions in a naive way, just for the sake of it.
And this is the code of despair. It's horrible, debugged with printfs, but it's the place where I got it :)
https://pastebin.com/LD0JMp64
Only for curious. I don't ask for help that much because I'm just going to rewrite it when my head is fresh, but just for curiosity, wtf?

13 ответов

7 просмотров

print unsigned int not int

also put hard casts where ever you can.

Naz-Klymok Автор вопроса
swarnim
also put hard casts where ever you can.

do you mean casting (void *) to (unsigned char *)?

what are you trying to do?

Naz-Klymok Автор вопроса
Daniele°
what are you trying to do?

a naive implementation of memmem, a function on string.h

Naz-Klymok Автор вопроса
Daniele°
what are you trying to do?

P.s. I figured it out , sent the code a few messages above

Naz Klymok
a naive implementation of memmem, a function on st...

void* meme(const void* m, size_t msz, const void* s, size_t ssz){ const void* f = m; while( (f=memchr(f, *(char*)s, msz-(f-m)) ){ if( f-m < ssz ) return NULL; if( !memcmp(f,s,ssz) ) return f; ++f; } return NULL; }

Daniele°
void* meme(const void* m, size_t msz, const void* ...

Btw what happens when ssz == 1, And the first char is s then?

Daniele°
?

I mean it seems to be returning NULL for the case When the first chr is the match and ssz == 1

Daniele°
Oh yes 😂

ssz - 1 should be the case

Похожие вопросы

Обсуждают сегодня

я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
в сях есть множество как в питоне? для удаление дубликатов
Linus
25
Hi everyone, long time no see! 🐼 recently i want to update our Ergo Eco-System map, can everyone help to find out, which to delete and other new to add in? list it, that i can...
HEROKOO
13
This topic is discussed al lot. Please use the search function for the answers. The same question pops up every two weeks. First check this video https://www.youtube.com/watch...
Enrico
2
зеленые ноты вижу, а коричневые?
οἰφέω σκάπτω
19
If arrr gets implemented on cake wallet. Would that mean arrr/xmr swaps possible in cake wallet like atomic swaps on komodowallet ?
Keks Meister 🏴‍☠️
22
читать файл максимально быстро? странный вопрос))
zamtmn
53
Yeh scammer hai kya ? 🙄 mujhre bhi solana invest ke liye bol re thi kal
Amit
18
30 BCH videos in Hausa Language successfully delivered. In December 2023, I created a Flipstarter to produce Bitcoin Cash videos in the Hausa language for greater outreach an...
Munnir
9
Я хочу запустить свой проект в тг. Что-то между пирамидой и майнилкой. Еще подобного ничего не было. Уникальная идея. Нужен именно не бот, а приложение. С ввод, выводом тон...
Павел А.
6
Карта сайта