Files
ImHex-Patterns/includes/libstd/math.pat
WerWolv 4eff8460ba includes: Added pattern language standard library (#19)
* libstd: Initial standard library work

bit operations, fixed point, numeric limits and math functions

* libstd: Added ctype, rustint, stdint and string library, expand bit, fxpt and math library

* patterns: Drastically improve ELF pattern

* patterns: Added atmosphere AFE2

* patterns: tabs -> spaces

* patterns: Added archive file pattern
2021-09-30 12:55:42 +02:00

20 lines
295 B
Plaintext

namespace std::math {
fn min(auto a, auto b) {
return a < b ? a : b;
};
fn max(auto a, auto b) {
return a > b ? a : b;
};
fn clamp(auto x, auto min, auto max) {
return (x < min) ? min : ((x > max) ? max : x);
};
fn abs(auto x) {
if (x < 0) return -x;
else return x;
};
}