diff options
| author | Mel <einebeere@gmail.com> | 2023-08-06 01:54:27 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-08-06 01:54:27 +0200 |
| commit | e6f5f9e03f673db796f1babb308609ca2576db2f (patch) | |
| tree | fbc7d9451ec943a107f0ab54b3de7a7bd25e656d /src/Math | |
| parent | a627fb7038c94de9be9709ea88dcd1dddc95c5a3 (diff) | |
| download | meowcraft-e6f5f9e03f673db796f1babb308609ca2576db2f.tar.zst meowcraft-e6f5f9e03f673db796f1babb308609ca2576db2f.zip | |
Improve MC::Position and remove some redundant code
Diffstat (limited to 'src/Math')
| -rw-r--r-- | src/Math/Mod.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Math/Mod.hpp b/src/Math/Mod.hpp new file mode 100644 index 0000000..d686ad9 --- /dev/null +++ b/src/Math/Mod.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace Math { + +// Returns the least nonnegative remainder of a % b. +// Euclidian definition of modulo. +template <typename A, typename B> +auto mod(A a, B b) -> decltype(a % b) { + return (a % b + b) % b; +} + +} \ No newline at end of file |
