Skip to content

Instantly share code, notes, and snippets.

@leifwalsh
Last active August 29, 2015 14:19
Show Gist options
  • Save leifwalsh/ae55f34b030bdaf9657b to your computer and use it in GitHub Desktop.
Save leifwalsh/ae55f34b030bdaf9657b to your computer and use it in GitHub Desktop.
// omg
fn true_mod<T: Copy>(a: T, n: T) -> <<<T as ops::Rem>::Output as ops::Add<T>>::Output as ops::Rem<T>>::Output
where T: ops::Add + ops::Rem,
<T as ops::Rem>::Output: ops::Add<T>,
<<T as ops::Rem>::Output as ops::Add<T>>::Output: ops::Rem<T>
{
(((a % n) + n) % n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment