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,29 +27,8 @@ 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)]
macro_rules! const_fn {
($(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))]
macro_rules! const_fn {
($(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_PACK(l: c_int, f: c_int, r: c_int) -> c_ulong { pub const fn ERR_PACK(l: c_int, f: c_int, r: c_int) -> c_ulong {
((l as c_ulong & 0x0FF) << 24) | ((l as c_ulong & 0x0FF) << 24) | ((f as c_ulong & 0xFFF) << 12) | (r as c_ulong & 0xFFF)
((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_LIB(l: c_uint) -> c_int {
@ -63,7 +42,6 @@ const_fn! {
pub const fn ERR_GET_REASON(l: c_uint) -> c_int { pub const fn ERR_GET_REASON(l: c_uint) -> c_int {
(l & 0xFFF) as c_int (l & 0xFFF) as c_int
} }
}
pub fn init() { pub fn init() {
use std::ptr; use std::ptr;