Skip to content

Instantly share code, notes, and snippets.

@Svetixbot
Created July 28, 2016 13:21
Show Gist options
  • Save Svetixbot/c67bd7c1e8175aa1a99fccc902c1bbb1 to your computer and use it in GitHub Desktop.
Save Svetixbot/c67bd7c1e8175aa1a99fccc902c1bbb1 to your computer and use it in GitHub Desktop.
use std::ops::BitAnd;
use std::cmp::PartialEq;
use std::num::{One, Zero};
fn even<T>(value: T) -> bool
where T: BitAnd<T, Output = T> + PartialEq + One + Zero {
value & T::one() == T::zero()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment