__ __ _ _ _ _ _
| \/ (_) (_) (_) |
| \ / |_ _ __ _| |_| |__ ___
| |\/| | | '_ \| | | | '_ \ / __|
| | | | | | | | | | | |_) | (__
|_| |_|_|_| |_|_|_|_|_.__/ \___|
Minilibc is a lightweight C library designed to reimplement key string and memory manipulation functions from the standard C library using assembly language.
The following functions are fully implemented in assembly:
-
String Manipulation
strlen
✅ — Calculate the length of a string.strchr
✅ — Locate the first occurrence of a character in a string.strcmp
✅ — Compare two strings.strncmp
✅ — Compare two strings up to a specified length.strcasecmp
✅ — Compare two strings ignoring case.strstr
✅ — Locate a substring within a string.strpbrk
✅ — Find the first occurrence of any character from a set.strcspn
✅ — Determine the length of a segment not containing specified characters.
-
Memory Manipulation
memset
✅ — Set a block of memory to a specific value.memmove
✅ — Safely copy memory areas that may overlap.
- Lightweight: Focused on essential functionality without the overhead of a full standard library.
- Educational: Ideal for learning about low-level programming and assembly language techniques.
-
Clone the Repository:
git clone https://github.com/yourusername/minilibc.git cd minilibc
-
Build the Library: Ensure you have an appropriate assembler and compiler toolchain installed.
make
-
Include Minilibc in Your Project: Link the
libasm.a
archive with your application during the build process:gcc -o your_program your_program.c -L. -lasm
Include the relevant headers in your C code, then call the functions as you would with the standard library:
#include "minilibc.h"
int main() {
char str[] = "Hello, world!";
size_t len = strlen(str);
printf("Length: %zu\n", len);
return 0;
}
- Core functions implemented:
strlen
,strchr
,memset
,strcmp
,memmove
,strncmp
,strcasecmp
,strstr
,strpbrk
,strcspn
.
- Add Unit Testing: Implement testing using Unity to ensure function correctness.
- Release Library on GitHub: Provide pre-built binaries and documentation.
- Add SIMD Optimization: Extend functionality with
libsimd
for enhanced performance.