#pragma once #include "irrt_typedefs.hpp" namespace { template T max(T a, T b) { return a > b ? a : b; } template T min(T a, T b) { return a > b ? b : a; } template bool arrays_match(int len, T *as, T *bs) { for (int i = 0; i < len; i++) { if (as[i] != bs[i]) return false; } return true; } void irrt_panic() { // Crash the program for now. // TODO: Don't crash the program // ... or at least produce a good message when doing testing IRRT uint8_t* death = nullptr; *death = 0; // TODO: address 0 on hardware might be writable? } // TODO: Make this a macro and allow it to be toggled on/off (e.g., debug vs release) void irrt_assert(bool condition) { if (!condition) irrt_panic(); } }