GitLab will be upgraded on 31 Jan 2023 from 2.00 pm (AEDT) to 3.00 pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

math.rs 826 Bytes
Newer Older
qinsoon's avatar
qinsoon committed
1
2
#[no_mangle]
#[allow(unreachable_code)]
3
pub extern fn muentry_frem_double(a: f64, b: f64) -> f64 {
qinsoon's avatar
qinsoon committed
4
5
6
    use std::ops::Rem;

    a.rem(b)
7
}
8
9
10
11
12
13
14

#[no_mangle]
#[allow(unreachable_code)]
pub extern fn muentry_frem_float(a: f32, b: f32) -> f32 {
    use std::ops::Rem;

    a.rem(b)
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

use extprim::u128::u128;
use extprim::i128::i128;

#[no_mangle]
#[allow(unreachable_code)]
pub extern fn muentry_udiv_u128(a: u128, b: u128) -> u128 {
    a.wrapping_div(b)
}

#[no_mangle]
#[allow(unreachable_code)]
pub extern fn muentry_sdiv_i128(a: i128, b: i128) -> i128 {
    a.wrapping_div(b)
}

#[no_mangle]
#[allow(unreachable_code)]
pub extern fn muentry_urem_u128(a: u128, b: u128) -> u128 {
    a.wrapping_rem(b)
}

#[no_mangle]
#[allow(unreachable_code)]
pub extern fn muentry_srem_i128(a: i128, b: i128) -> i128 {
    a.wrapping_rem(b)
42
}