Clean up legacy const_fn feature gates

This commit is contained in:
Rushil Mehra 2024-07-26 13:12:03 -07:00 committed by Rushil Mehra
parent 4fe43f85d1
commit 6e9ba1cb96
1 changed files with 9 additions and 31 deletions

View File

@ -27,42 +27,20 @@ pub type BN_ULONG = u64;
#[cfg(target_pointer_width = "32")] #[cfg(target_pointer_width = "32")]
pub type BN_ULONG = u32; pub type BN_ULONG = u32;
#[cfg(const_fn)] pub const fn ERR_PACK(l: c_int, f: c_int, r: c_int) -> c_ulong {
macro_rules! const_fn { ((l as c_ulong & 0x0FF) << 24) | ((f as c_ulong & 0xFFF) << 12) | (r as c_ulong & 0xFFF)
($(pub const fn $name:ident($($arg:ident: $t:ty),*) -> $ret:ty $b:block)*) => {
$(
pub const fn $name($($arg: $t),*) -> $ret $b
)*
}
} }
#[cfg(not(const_fn))] pub const fn ERR_GET_LIB(l: c_uint) -> c_int {
macro_rules! const_fn { ((l >> 24) & 0x0FF) as c_int
($(pub const fn $name:ident($($arg:ident: $t:ty),*) -> $ret:ty $b:block)*) => {
$(
pub fn $name($($arg: $t),*) -> $ret $b
)*
}
} }
const_fn! { pub const fn ERR_GET_FUNC(l: c_uint) -> c_int {
pub const fn ERR_PACK(l: c_int, f: c_int, r: c_int) -> c_ulong { ((l >> 12) & 0xFFF) as c_int
((l as c_ulong & 0x0FF) << 24) | }
((f as c_ulong & 0xFFF) << 12) |
(r as c_ulong & 0xFFF)
}
pub const fn ERR_GET_LIB(l: c_uint) -> c_int { pub const fn ERR_GET_REASON(l: c_uint) -> c_int {
((l >> 24) & 0x0FF) as c_int (l & 0xFFF) as c_int
}
pub const fn ERR_GET_FUNC(l: c_uint) -> c_int {
((l >> 12) & 0xFFF) as c_int
}
pub const fn ERR_GET_REASON(l: c_uint) -> c_int {
(l & 0xFFF) as c_int
}
} }
pub fn init() { pub fn init() {