Hacker News new | ask | show | jobs
by ekidd 4202 days ago
General question about rust: Is there any way to reliably write constant time code in it? Or are you always at the mercy of the compiler undermining you?

Rust generates LLVM code, which means that the optimizer is going to do pretty much the same stuff you'd expect from clang (except that with Rust, LLVM doesn't need to worry as much about aliasing, so it can be more aggressive). For inline assembly, see:

http://doc.rust-lang.org/guide-unsafe.html#inline-assembly

Rust also has a very convenient FFI, so if you have a chunk of assembly which uses the platform ABI, you can wrap it and call it easily.