forked from M-Labs/nac3
1
0
Fork 0
nac3/nac3core/irrt/irrt_utils.hpp

27 lines
570 B
C++
Raw Normal View History

2024-07-10 11:56:31 +08:00
#pragma once
#include "irrt_typedefs.hpp"
namespace {
template <typename T>
T max(T a, T b) {
return a > b ? a : b;
}
template <typename T>
T min(T a, T b) {
return a > b ? b : a;
}
void nac3_assert(bool condition) {
// Doesn't do anything (for now (?))
// Helps to make code self-documenting
if (!condition) {
// TODO: don't crash the program
// TODO: address 0 on hardware might be writable?
uint8_t* death = nullptr;
*death = 0;
}
}
}