This file contains hidden or 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
| #include <unistd.h> | |
| #include <stdio.h> | |
| #include <fcntl.h> | |
| char buffer[4096]; | |
| int main(int argc, char *argv[]) | |
| { | |
| int fd, i, off; | |
| long bk, byte; |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <string.h> | |
| void* my_memcpy(void* destination, void* source, size_t num) | |
| { | |
| int i; | |
| char* d = destination; | |
| char* s = source; | |
| for (i = 0; i < num; i++) { | |
| d[i] = s[i]; |
This file contains hidden or 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
| all: mystrlen strlen | |
| mystrlen: mystrlen.c makestrs.h | |
| gcc -O2 mystrlen.c -o mystrlen | |
| strlen: strlen.c makestrs.h | |
| gcc -O2 strlen.c -o strlen | |
| clean: | |
| rm mystrlen strlen | |
| test: mystrlen strlen | |
| time ./mystrlen > /dev/null | |
| time ./strlen > /dev/null |
NewerOlder