pub fn is_flag_set<T: PrimInt>(x: T, flag: T) -> bool
Expand description

Returns whether the given flag is set.

It doesn’t check if the provided flag is really flag.

Examples

extern crate xor_distance_exercise;

use xor_distance_exercise::bitops::is_flag_set;

let x = 0b1101;
let flag = 0b0001;

assert!(is_flag_set(x, flag));