diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-05-17 22:25:04 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-05-17 22:25:04 +0200 |
| commit | c0428f8e5feba9573e572a1a1b3c66cfa1f29108 (patch) | |
| tree | a0ecdb03c667558133a23cd7cb546a3e84489659 /Boot/BootKit | |
| parent | 9ebaf586257bf42996881b70a79cb2d57d8fd1ef (diff) | |
MHR-23: Improve scheduler code.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Boot/BootKit')
| -rw-r--r-- | Boot/BootKit/BootKit.hxx | 2 | ||||
| -rw-r--r-- | Boot/BootKit/Vendor/Qr.hxx | 14 | ||||
| -rw-r--r-- | Boot/BootKit/Vendor/Shared/base.h (renamed from Boot/BootKit/Vendor/QrVendor/base.h) | 0 | ||||
| -rw-r--r-- | Boot/BootKit/Vendor/Shared/bit.h (renamed from Boot/BootKit/Vendor/QrVendor/bit.h) | 0 | ||||
| -rw-r--r-- | Boot/BootKit/Vendor/Support.hxx | 17 |
5 files changed, 19 insertions, 14 deletions
diff --git a/Boot/BootKit/BootKit.hxx b/Boot/BootKit/BootKit.hxx index 179ca141..6ddecca1 100644 --- a/Boot/BootKit/BootKit.hxx +++ b/Boot/BootKit/BootKit.hxx @@ -360,7 +360,7 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const char* partName, fDiskDev.Write(buf, sectorSz); BTextWriter writer; - writer.Write(L"New Boot: Write-Partition, OK.\r"); + writer.Write(L"New Boot: Write-Partition: OK.\r"); return true; } diff --git a/Boot/BootKit/Vendor/Qr.hxx b/Boot/BootKit/Vendor/Qr.hxx index 1df0bdaf..3bafc09f 100644 --- a/Boot/BootKit/Vendor/Qr.hxx +++ b/Boot/BootKit/Vendor/Qr.hxx @@ -5,14 +5,16 @@ #include <stddef.h> #include <stdint.h> -#include <BootKit/Vendor/QrVendor/base.h> -#include <BootKit/Vendor/QrVendor/bit.h> +#include <BootKit/Vendor/Shared/base.h> +#include <BootKit/Vendor/Shared/bit.h> #include <BootKit/Vendor/QrPrelude.hxx> #include <Builtins/Toolbox/Toolbox.hxx> #include <BootKit/Vendor/Support.hxx> #include <CompilerKit/Detail.hxx> +/// @note the QR code is still code 128, it utilizes the same concept of having it's own character set. + namespace qr { inline uint8_t min_poly = @@ -285,14 +287,6 @@ namespace qr { return SIDE; } - constexpr auto data_size() const - { - return N_BITS; - } - constexpr auto data_ptr() const - { - return code; - } bool module(int x, int y); bool encode(const char* str, size_t len, Ecc ecc, int mask = -1); diff --git a/Boot/BootKit/Vendor/QrVendor/base.h b/Boot/BootKit/Vendor/Shared/base.h index a98ae4f0..a98ae4f0 100644 --- a/Boot/BootKit/Vendor/QrVendor/base.h +++ b/Boot/BootKit/Vendor/Shared/base.h diff --git a/Boot/BootKit/Vendor/QrVendor/bit.h b/Boot/BootKit/Vendor/Shared/bit.h index 94ab0bf2..94ab0bf2 100644 --- a/Boot/BootKit/Vendor/QrVendor/bit.h +++ b/Boot/BootKit/Vendor/Shared/bit.h diff --git a/Boot/BootKit/Vendor/Support.hxx b/Boot/BootKit/Vendor/Support.hxx index d8075152..a2c2af65 100644 --- a/Boot/BootKit/Vendor/Support.hxx +++ b/Boot/BootKit/Vendor/Support.hxx @@ -6,7 +6,8 @@ #pragma once -/// @file Purpose of this file is to help port libs into the bootloader. +/// @file Support.hxx +/// @brief Purpose of this file is to help port libs into the bootloader. #include <BootKit/BootKit.hxx> @@ -18,7 +19,7 @@ #define CopyMem(dst, src, sz) memcpy(dst, src, sz) #define StrLen(src) strlen(src) -inline int isspace(int c) +inline int IsSpace(int c) { return c == ' '; } @@ -27,16 +28,21 @@ inline long StringToLong(const char* nptr, char** endptr, int base) { const char *p = nptr, *endp; bool is_neg = 0, overflow = 0; + /* Need unsigned so (-cLongMin) can fit in these: */ unsigned long n = 0UL, cutoff; int cutlim; + if (base < 0 || base == 1 || base > 36) { return 0L; } + endp = nptr; - while (isspace(*p)) + + while (IsSpace(*p)) p++; + if (*p == '+') { p++; @@ -81,8 +87,10 @@ inline long StringToLong(const char* nptr, char** endptr, int base) { base = 10; } + cutoff = (is_neg) ? -(cLongMin / base) : cLongMax / base; cutlim = (is_neg) ? -(cLongMin % base) : cLongMax % base; + while (1) { int c; @@ -110,11 +118,14 @@ inline long StringToLong(const char* nptr, char** endptr, int base) } n = n * base + c; } + if (endptr) *endptr = (char*)endp; + if (overflow) { return ((is_neg) ? cLongMin : cLongMax); } + return (long)((is_neg) ? -n : n); } |
