Skip to content

Commit

Permalink
inline single use functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Nov 13, 2023
1 parent d93d5e6 commit b5159e9
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions src/std_extensions/arithmetic/float_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,22 @@ use super::float_types::FLOAT64_TYPE;
/// The extension identifier.
pub const EXTENSION_ID: ExtensionId = ExtensionId::new_unchecked("arithmetic.float");

fn fcmp_sig() -> PolyFuncType {
FunctionType::new(
type_row![FLOAT64_TYPE; 2],
type_row![crate::extension::prelude::BOOL_T],
)
.into()
}

fn fbinop_sig() -> PolyFuncType {
FunctionType::new(type_row![FLOAT64_TYPE; 2], type_row![FLOAT64_TYPE]).into()
}

fn funop_sig() -> PolyFuncType {
FunctionType::new(type_row![FLOAT64_TYPE], type_row![FLOAT64_TYPE]).into()
}

/// Extension for basic arithmetic operations.
pub fn extension() -> Extension {
let mut extension = Extension::new_with_reqs(
EXTENSION_ID,
ExtensionSet::singleton(&super::float_types::EXTENSION_ID),
);

let fcmp_sig = fcmp_sig();
let fbinop_sig = fbinop_sig();
let funop_sig = funop_sig();
let fcmp_sig: PolyFuncType = FunctionType::new(
type_row![FLOAT64_TYPE; 2],
type_row![crate::extension::prelude::BOOL_T],
)
.into();
let fbinop_sig: PolyFuncType =
FunctionType::new(type_row![FLOAT64_TYPE; 2], type_row![FLOAT64_TYPE]).into();
let funop_sig: PolyFuncType =
FunctionType::new(type_row![FLOAT64_TYPE], type_row![FLOAT64_TYPE]).into();
extension
.add_op_type_scheme_simple("feq".into(), "equality test".to_owned(), fcmp_sig.clone())
.unwrap();
Expand Down

0 comments on commit b5159e9

Please sign in to comment.