Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: usize multiplication overflow on 32bit machines #295

Merged
merged 1 commit into from
Oct 12, 2023
Merged

fix: usize multiplication overflow on 32bit machines #295

merged 1 commit into from
Oct 12, 2023

Conversation

de-sh
Copy link
Contributor

@de-sh de-sh commented Oct 12, 2023

Closes #

Changes

Why?

on 32bit machines 99 * 571421193 overflows

Trials Performed

fn main() {
    let x = 571401090;
    assert_eq!(dbg!(99.99 * x as f64 / 571421193 as f64) as u8, 99);

    // let x = 571401090;
    // assert_eq!(dbg!(99_usize * x / 571421193_usize) as u8, 99);
}

run against armv7 with cross run --target=armv7-linux-androideabi

on 32bit machines 99 * 571421193 overflows
@de-sh de-sh marked this pull request as ready for review October 12, 2023 13:12
@de-sh de-sh changed the title fix: usize multiplication overflow fix: usize multiplication overflow on 32bit machines Oct 12, 2023
@de-sh de-sh merged commit 64ff2df into main Oct 12, 2023
2 checks passed
@de-sh de-sh deleted the factor branch October 12, 2023 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant