sdutil Write DOS Master Boot Record
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m7s

This commit is contained in:
2026-03-20 21:20:30 +01:00
parent fd800f6210
commit 46710bb2dc
4 changed files with 114 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
c += string.c
c += string.c \
strconv.c
o += string.o
o += string.o \
strconv.o

15
libstring/strconv.c Normal file
View File

@@ -0,0 +1,15 @@
#include <stdint.h>
uint64_t str_to_uint64 (const char* s) {
uint64_t r = 0;
if (!s)
return 0;
while (*s >= '0' && *s <= '9') {
r = r * 10 + (*s - '0');
s++;
}
return r;
}

12
libstring/strconv.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef _LIBSTRING_STRCONV_H
#define _LIBSTRING_STRCONV_H
#include <stdint.h>
#define str_to_uint32(s) ((uint32_t)str_to_uint64 ((s)))
#define str_to_uint16(s) ((uint16_t)str_to_uint64 ((s)))
#define str_to_uint8(s) ((uint8_t)str_to_uint64 ((s)))
uint64_t str_to_uint64 (const char* s);
#endif // _LIBSTRING_STRCONV_H