//! returns: 0 //! Full-arity calls preserve argument order and live values. /// Encode eight arguments in distinct decimal positions. fn digits(a: u64, b: u64, c: u64, d: u64, e: u64, f: u64, g: u64, h: u64) -> u64 { return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h; } /// Retain argument values and the target across two indirect calls. fn invoke(callback: fn(u64, u64, u64, u64, u64, u64, u64, u64) -> u64, values: &[u64]) -> u64 { let a = values[0]; let b = values[1]; let c = values[2]; let d = values[3]; let e = values[4]; let f = values[5]; let g = values[6]; let h = values[7]; let reversed = callback(h, g, f, e, d, c, b, a); let ordered = callback(a, b, c, d, e, f, g, h); return reversed + ordered + a + b + c + d + e + f + g + h; } /// Check direct argument placement and repeated indirect calls. @default fn main() -> u32 { let values: [u64; 8] = [1, 2, 3, 4, 5, 6, 7, 8]; assert digits(1, 2, 3, 4, 5, 6, 7, 8) == 87654321; assert invoke(digits, &values[..]) == 100000035; return 0; }