@@ -20,51 +20,47 @@ cfg_if! {
20
20
21
21
pub const ERR_RFLAG_FATAL : c_ulong = 0x1 << ERR_RFLAGS_OFFSET ;
22
22
23
- const_fn! {
24
- pub const fn ERR_SYSTEM_ERROR ( errcode: c_ulong) -> bool {
25
- errcode & ERR_SYSTEM_FLAG != 0
26
- }
23
+ pub const fn ERR_SYSTEM_ERROR ( errcode: c_ulong) -> bool {
24
+ errcode & ERR_SYSTEM_FLAG != 0
25
+ }
27
26
28
- pub const fn ERR_GET_LIB ( errcode: c_ulong) -> c_int {
29
- // hacks since `if` isn't yet stable in const functions :(
30
- ( ( ERR_LIB_SYS as c_ulong * ( ERR_SYSTEM_ERROR ( errcode) as c_ulong) ) |
31
- ( ( ( errcode >> ERR_LIB_OFFSET ) & ERR_LIB_MASK ) * ( !ERR_SYSTEM_ERROR ( errcode) as c_ulong) ) ) as c_int
32
- }
27
+ pub const fn ERR_GET_LIB ( errcode: c_ulong) -> c_int {
28
+ // hacks since `if` isn't yet stable in const functions :(
29
+ ( ( ERR_LIB_SYS as c_ulong * ( ERR_SYSTEM_ERROR ( errcode) as c_ulong) ) |
30
+ ( ( ( errcode >> ERR_LIB_OFFSET ) & ERR_LIB_MASK ) * ( !ERR_SYSTEM_ERROR ( errcode) as c_ulong) ) ) as c_int
31
+ }
33
32
34
- pub const fn ERR_GET_FUNC ( _errcode: c_ulong) -> c_int {
35
- 0
36
- }
33
+ pub const fn ERR_GET_FUNC ( _errcode: c_ulong) -> c_int {
34
+ 0
35
+ }
37
36
38
- pub const fn ERR_GET_REASON ( errcode: c_ulong) -> c_int {
39
- // hacks since `if` isn't yet stable in const functions :(
40
- ( ( ERR_LIB_SYS as c_ulong * ( ERR_SYSTEM_ERROR ( errcode) as c_ulong) ) |
41
- ( ( errcode & ERR_REASON_MASK ) * ( !ERR_SYSTEM_ERROR ( errcode) as c_ulong) ) ) as c_int
42
- }
37
+ pub const fn ERR_GET_REASON ( errcode: c_ulong) -> c_int {
38
+ // hacks since `if` isn't yet stable in const functions :(
39
+ ( ( ERR_LIB_SYS as c_ulong * ( ERR_SYSTEM_ERROR ( errcode) as c_ulong) ) |
40
+ ( ( errcode & ERR_REASON_MASK ) * ( !ERR_SYSTEM_ERROR ( errcode) as c_ulong) ) ) as c_int
41
+ }
43
42
44
- pub const fn ERR_PACK ( lib: c_int, _func: c_int, reason: c_int) -> c_ulong {
45
- ( ( lib as c_ulong & ERR_LIB_MASK ) << ERR_LIB_OFFSET ) |
46
- ( reason as c_ulong & ERR_REASON_MASK )
47
- }
43
+ pub const fn ERR_PACK ( lib: c_int, _func: c_int, reason: c_int) -> c_ulong {
44
+ ( ( lib as c_ulong & ERR_LIB_MASK ) << ERR_LIB_OFFSET ) |
45
+ ( reason as c_ulong & ERR_REASON_MASK )
48
46
}
49
47
} else {
50
- const_fn! {
51
- pub const fn ERR_PACK ( l: c_int, f: c_int, r: c_int) -> c_ulong {
52
- ( ( l as c_ulong & 0x0FF ) << 24 ) |
53
- ( ( f as c_ulong & 0xFFF ) << 12 ) |
54
- ( r as c_ulong & 0xFFF )
55
- }
48
+ pub const fn ERR_PACK ( l: c_int, f: c_int, r: c_int) -> c_ulong {
49
+ ( ( l as c_ulong & 0x0FF ) << 24 ) |
50
+ ( ( f as c_ulong & 0xFFF ) << 12 ) |
51
+ ( r as c_ulong & 0xFFF )
52
+ }
56
53
57
- pub const fn ERR_GET_LIB ( l: c_ulong) -> c_int {
58
- ( ( l >> 24 ) & 0x0FF ) as c_int
59
- }
54
+ pub const fn ERR_GET_LIB ( l: c_ulong) -> c_int {
55
+ ( ( l >> 24 ) & 0x0FF ) as c_int
56
+ }
60
57
61
- pub const fn ERR_GET_FUNC ( l: c_ulong) -> c_int {
62
- ( ( l >> 12 ) & 0xFFF ) as c_int
63
- }
58
+ pub const fn ERR_GET_FUNC ( l: c_ulong) -> c_int {
59
+ ( ( l >> 12 ) & 0xFFF ) as c_int
60
+ }
64
61
65
- pub const fn ERR_GET_REASON ( l: c_ulong) -> c_int {
66
- ( l & 0xFFF ) as c_int
67
- }
62
+ pub const fn ERR_GET_REASON ( l: c_ulong) -> c_int {
63
+ ( l & 0xFFF ) as c_int
68
64
}
69
65
}
70
66
}
0 commit comments