diff --git a/posts/inside-rust/2020-06-08-new-inline-asm.md b/posts/inside-rust/2020-06-08-new-inline-asm.md index 252962876..f2df0afca 100644 --- a/posts/inside-rust/2020-06-08-new-inline-asm.md +++ b/posts/inside-rust/2020-06-08-new-inline-asm.md @@ -94,17 +94,16 @@ fn main() { for value in 0..=1024u64 { let popcnt; unsafe { - asm!(" - popcnt {popcnt}, {v} - 2: - blsi rax, {v} - jz 1f - xor {v}, rax - tzcnt rax, rax - stosb - jmp 2b - 1: - ", + asm!( + "popcnt {popcnt}, {v}", + "2:", + "blsi rax, {v}", + "jz 1f", + "xor {v}, rax", + "tzcnt rax, rax", + "stosb", + "jmp 2b", + "1:", v = inout(reg) value => _, popcnt = out(reg) popcnt, out("rax") _, // scratch @@ -117,7 +116,7 @@ fn main() { ``` (You can [try this example on the -playground](https://play.rust-lang.org/?version=nightly&mode=release&edition=2018&gist=38874735e48aa20289f23f5a3cbeae0c). +playground](https://play.rust-lang.org/?version=nightly&mode=release&edition=2018&gist=894a407f0fe858559aa378edf6ec4801). Note that this code serves to demonstrate inline assembly, not to demonstrate an efficient implementation of any particular algorithm.)