Added bitmap_t type and bmap_* functions & used them in PMM

This commit is contained in:
2025-04-05 15:44:55 +02:00
parent 25771de53e
commit b104755904
7 changed files with 127 additions and 102 deletions
+5 -7
View File
@@ -1,4 +1,6 @@
#include <kernel.h>
#include <string.h>
#include <vsnprintf.h>
int pf_isdigit(char c) {
@@ -25,10 +27,6 @@ char* pf_itoa(uint32_t num, uint8_t base) {
return &buf[i + 1];
}
char* pf_ftoa(float f) {
return NULL;
}
int vsnprintf(char* buf, size_t len, char* fmt, va_list args) {
size_t i = 0;
@@ -68,13 +66,13 @@ int vsnprintf(char* buf, size_t len, char* fmt, va_list args) {
case 'x': // Unsigned hex int
s = pf_itoa(va_arg(args, unsigned int), 16);
goto string;
case 'f': // Float
s = pf_ftoa(va_arg(args, double));
goto string;
// TODO: %f for float
case 's': // String
s = va_arg(args, char*);
string: // Prints the string in s
if (s == NULL) s = "(null)";
width -= strlen(s);
while (width-- >= 0 && i < len) buf[i++] = pad;
while (*s != '\0' && i < len) buf[i++] = *s++;
break;
default: // Something else