aboutsummaryrefslogtreecommitdiff
path: root/libk
diff options
context:
space:
mode:
Diffstat (limited to 'libk')
-rw-r--r--libk/stdlib.h9
-rw-r--r--libk/string.h1
-rw-r--r--libk/string/integerview.cc5
3 files changed, 10 insertions, 5 deletions
diff --git a/libk/stdlib.h b/libk/stdlib.h
index 1b76b67..7d89a0c 100644
--- a/libk/stdlib.h
+++ b/libk/stdlib.h
@@ -4,11 +4,12 @@
class Console {
public:
- virtual void write(char c) = 0;
- virtual void write(ViewIterator& msg) = 0;
+ virtual ~Console() = default;
+ virtual void write(char c) = 0;
+ virtual void write(ViewIterator& msg) = 0;
- static void set(Console* ptr);
- static Console* get();
+ static void set(Console* ptr);
+ static Console* get();
};
template <typename T>
diff --git a/libk/string.h b/libk/string.h
index 03c0942..30824b8 100644
--- a/libk/string.h
+++ b/libk/string.h
@@ -65,6 +65,7 @@ public:
};
IntegerView(int32_t n);
+ IntegerView(uint32_t n);
IntegerView(HexFormat_int32 f);
IntegerView(HexFormat_uint32 f);
diff --git a/libk/string/integerview.cc b/libk/string/integerview.cc
index beeb561..dc4c80a 100644
--- a/libk/string/integerview.cc
+++ b/libk/string/integerview.cc
@@ -9,7 +9,7 @@ constexpr size_t itoa(T n, char s[]) {
n = -n;
}
- int i = 0;
+ size_t i = 0;
do { /* generate digits in reverse order */
s[i++] = "0123456789abcdef"[n % base]; /* get next digit */
} while ((n /= base) > 0); /* delete it */
@@ -26,6 +26,9 @@ constexpr size_t itoa(T n, char s[]) {
IntegerView::IntegerView(int32_t n) {
length = itoa(n, buffer);
}
+IntegerView::IntegerView(uint32_t n) {
+ length = itoa(n, buffer);
+}
IntegerView::IntegerView(HexFormat_int32 f) {
length = itoa<int32_t, 16>(f.n, buffer);