diff --git a/c_os/kernel/allocator/LinkedListAllocator.h b/c_os/kernel/allocator/LinkedListAllocator.h index 9590e1e..4ac2a72 100755 --- a/c_os/kernel/allocator/LinkedListAllocator.h +++ b/c_os/kernel/allocator/LinkedListAllocator.h @@ -33,7 +33,7 @@ private: struct free_block* find_previous_block(struct free_block*); public: - LinkedListAllocator() {} + LinkedListAllocator() {}; void init(); void dump_free_memory(); diff --git a/c_os/lib/Math.cc b/c_os/lib/Math.cc new file mode 100644 index 0000000..0647c40 --- /dev/null +++ b/c_os/lib/Math.cc @@ -0,0 +1,26 @@ +#include "Math.h" + +// NOTE: I added this file + +int min(int a, int b) { + if (a < b) { return a; } + return b; +} + +int max(int a, int b) { + if (a < b) { return b; } + return a; +} + +int abs(int a) { + if (a < 0) { return -a; } + return a; +} + +int pow(int a, unsigned int b) { + int result = 1; + for (unsigned int i = 0; i < b; ++i) { + result = result * a; + } + return result; +} diff --git a/c_os/lib/Math.h b/c_os/lib/Math.h new file mode 100644 index 0000000..fd0ee38 --- /dev/null +++ b/c_os/lib/Math.h @@ -0,0 +1,11 @@ +#ifndef __MATH_INCLUDE_H_ +#define __MATH_INCLUDE_H_ + +// NOTE: I added this file + +int min(int, int); +int max(int, int); +int abs(int); +int pow(int, unsigned int); + +#endif