Tease apart utility.hpp, other header dependencies.

Trying to get a host-testable FSK demodulator, and finding a lot of M4- and ChibiOS-specific code is getting included. Boo.
This commit is contained in:
Jared Boone 2015-10-15 15:17:40 -07:00
parent e049097f49
commit f82fd1f8d7
13 changed files with 135 additions and 64 deletions

View file

@ -19,8 +19,6 @@
* Boston, MA 02110-1301, USA.
*/
#include <ch.h>
#include "utility.hpp"
#include <cstdint>
@ -115,22 +113,3 @@ static constexpr uint32_t gcd_top(const uint32_t u, const uint32_t v) {
uint32_t gcd(const uint32_t u, const uint32_t v) {
return gcd_top(u, v);
}
/* Memory management, overriding toolchain new, which uses malloc */
/* TODO: Move to something like "memory.cpp"! Not utility.cpp. */
void* operator new(size_t size) {
return chHeapAlloc(0x0, size);
}
void* operator new[](size_t size) {
return chHeapAlloc(0x0, size);
}
void operator delete(void* p) noexcept {
chHeapFree(p);
}
void operator delete[](void* p) noexcept {
chHeapFree(p);
}