Skip to content

Commit

Permalink
refactor: use PolyFunctType to define int ops extension
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Nov 10, 2023
1 parent 2356a1a commit 564c140
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 205 deletions.
12 changes: 3 additions & 9 deletions src/std_extensions/arithmetic/conversions.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
//! Conversions between integer and floating-point values.
use crate::{
extension::{ExtensionId, ExtensionRegistry, ExtensionSet, SignatureError, TypeDef, PRELUDE},
extension::{ExtensionId, ExtensionRegistry, ExtensionSet, SignatureError, PRELUDE},
type_row,
types::{type_param::TypeArg, FunctionType, PolyFuncType, Type},
types::{FunctionType, PolyFuncType, Type},
Extension,
};

use super::int_types::INT_TYPE_ID;
use super::int_types::{int_type_var, INT_TYPE_ID};
use super::{float_types::FLOAT64_TYPE, int_types::LOG_WIDTH_TYPE_PARAM};

/// The extension identifier.
pub const EXTENSION_ID: ExtensionId = ExtensionId::new_unchecked("arithmetic.conversions");

fn int_type_var(var_id: usize, int_type_def: &TypeDef) -> Result<Type, SignatureError> {
Ok(Type::new_extension(int_type_def.instantiate(vec![
TypeArg::new_var_use(var_id, LOG_WIDTH_TYPE_PARAM),
])?))
}

fn ftoi_sig(
int_type_var: Type,
temp_reg: &ExtensionRegistry,
Expand Down
Loading

0 comments on commit 564c140

Please sign in to comment.