Stream: general

Topic: How to use IntCC::Overflow?


view this post on Zulip Adel Prokurov (Feb 10 2021 at 08:51):

I need to detect when addition of two i32's overflow, how I can do this using intcc::overflow?

view this post on Zulip bjorn3 (Feb 10 2021 at 08:55):

I don't know how to use IntCC::Overflow. I use the following in cg_clif instead: https://github.com/bjorn3/rustc_codegen_cranelift/blob/c5dff34ae97007ed5a6f53b9b8c71b4d40cde997/src/num.rs#L227-L235

Cranelift based backend for rustc. Contribute to bjorn3/rustc_codegen_cranelift development by creating an account on GitHub.

view this post on Zulip Adel Prokurov (Feb 10 2021 at 08:57):

this will generate more code for x64. There is really no way to do jo on overflow for x64?

view this post on Zulip bjorn3 (Feb 10 2021 at 09:00):

I don't know.

view this post on Zulip Adel Prokurov (Feb 10 2021 at 09:08):

I think I found what I need. It is possible to use iadd_ifcout + brif with IntCC::Overflow


Last updated: Nov 22 2024 at 16:03 UTC