mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-28 07:47:02 -05:00
includes/std: Added fixed point change_precision function
This commit is contained in:
@@ -9,6 +9,10 @@ namespace std::fxpt {
|
||||
fn to_fixed(double flt, u32 precision) {
|
||||
return fixed((flt * (1 << precision)));
|
||||
};
|
||||
|
||||
fn change_precision(fixed value, u32 start_precision, u32 end_precision) {
|
||||
return std::fxpt::to_fixed(std::fxpt::to_float(value, start_precision), end_precision);
|
||||
}
|
||||
|
||||
fn add(fixed a, fixed b, u32 precision) {
|
||||
return a + b;
|
||||
|
||||
Reference in New Issue
Block a user