Allow to easily check the generated assembly

This commit is contained in:
Quentin Boyer 2024-12-05 00:12:10 +01:00
parent 345914c97a
commit 6674696505
3 changed files with 7 additions and 1 deletions

View file

@ -22,7 +22,7 @@
inherit system; inherit system;
overlays = [ (import rust-overlay) ]; overlays = [ (import rust-overlay) ];
}; };
rust = pkgs.rust-bin.stable.latest.default; rust = pkgs.rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; };
naersk' = pkgs.callPackage naersk { naersk' = pkgs.callPackage naersk {
cargo = rust; cargo = rust;
rustc = rust; rustc = rust;
@ -38,6 +38,7 @@
++ (with pkgs; [ ++ (with pkgs; [
hyperfine hyperfine
cargo-flamegraph cargo-flamegraph
cargo-show-asm
]); ]);
RUST_PATH = "${rust}"; RUST_PATH = "${rust}";
RUST_DOC_PATH = "${rust}/share/doc/rust/html/std/index.html"; RUST_DOC_PATH = "${rust}/share/doc/rust/html/std/index.html";

View file

@ -43,6 +43,7 @@ fn rays<'a, T>(
.map(|ray| ray.map(|(x, y)| &table[x][y])) .map(|ray| ray.map(|(x, y)| &table[x][y]))
} }
#[inline(never)]
pub fn part1(input: Parsed) { pub fn part1(input: Parsed) {
let expected = b"XMAS"; let expected = b"XMAS";
let mut ray_count = 0; let mut ray_count = 0;
@ -60,6 +61,7 @@ pub fn part1(input: Parsed) {
print_res!("Word count: {ray_count}"); print_res!("Word count: {ray_count}");
} }
#[inline(never)]
pub fn part2(input: Parsed) { pub fn part2(input: Parsed) {
let mut cross_count = 0; let mut cross_count = 0;
let expected = *b"MAS"; let expected = *b"MAS";

View file

@ -5,14 +5,17 @@ use bstr::BString;
type Parsed = (); type Parsed = ();
#[inline(never)]
pub fn parsing(input: &BString) -> color_eyre::Result<Parsed> { pub fn parsing(input: &BString) -> color_eyre::Result<Parsed> {
todo!("Parsing") todo!("Parsing")
} }
#[inline(never)]
pub fn part1(input: Parsed) { pub fn part1(input: Parsed) {
todo!("todo part1") todo!("todo part1")
} }
#[inline(never)]
pub fn part2(input: Parsed) { pub fn part2(input: Parsed) {
todo!("todo part2") todo!("todo part2")
} }