1/// Display a value in binary with a given bit width. 2pub fn to_binary_string(val: u64, width: usize) -> String { 3 format!("{:0>width$b}", val, width = width) 4} 5 6/// Simple assertion helper with descriptive message for exercises. 7pub fn check(condition: bool, msg: &str) { 8 assert!(condition, "Exercise check failed: {}", msg); 9} 10 11