Created
May 28, 2020 11:17
-
-
Save dns2utf8/421a51d04551cb21728a329c091f110e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(test)] | |
use std::hint::black_box; | |
#[inline(never)] | |
fn calc1(n: u32) -> u32 { | |
n * n | |
} | |
#[inline(never)] | |
fn calc2(n: u32) -> u32 { | |
n.pow(2) | |
} | |
fn main() { | |
let input = black_box(7); | |
let _a = calc1(input); | |
let _b = calc2(input); | |
println!("{} {}", _a, _b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run on play.rust-lang.org