Read files with temp fix
This commit is contained in:
18
include/PSX/Auxiliary/math_helper.hpp
Normal file
18
include/PSX/Auxiliary/math_helper.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef __JABYENGINE_MATH_HELPER_HPP__
|
||||
#define __JABYENGINE_MATH_HELPER_HPP__
|
||||
#include "types.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
template<typename T>
|
||||
static constexpr pair<T, T> div_and_mod(T value, T div) {
|
||||
const auto result = value/div;
|
||||
return {static_cast<T>(result), static_cast<T>(value - (result*div))};
|
||||
}
|
||||
|
||||
static constexpr uint8_t to_bcd(uint8_t value) {
|
||||
const auto [tenth, rest] = div_and_mod(value, static_cast<uint8_t>(10));
|
||||
return (tenth << 4 | rest);
|
||||
}
|
||||
}
|
||||
|
||||
#endif //!__JABYENGINE_MATH_HELPER_HPP__
|
Reference in New Issue
Block a user