move ratio to own crate (again)
This commit is contained in:
parent
fc65d0f1f4
commit
91b96e4b5d
5
fixed_wide/Cargo.lock
generated
5
fixed_wide/Cargo.lock
generated
@ -21,6 +21,7 @@ dependencies = [
|
||||
"arrayvec",
|
||||
"bnum",
|
||||
"paste",
|
||||
"ratio_ops",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -28,3 +29,7 @@ name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "ratio_ops"
|
||||
version = "0.1.0"
|
||||
|
@ -4,8 +4,8 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
default=["ratio","zeroes","wide-mul"]
|
||||
ratio=[]
|
||||
default=["deferred-division","zeroes","wide-mul"]
|
||||
deferred-division=["dep:ratio_ops"]
|
||||
wide-mul=[]
|
||||
zeroes=["dep:arrayvec"]
|
||||
|
||||
@ -13,3 +13,4 @@ zeroes=["dep:arrayvec"]
|
||||
bnum = "0.11.0"
|
||||
arrayvec = { version = "0.7.6", optional = true }
|
||||
paste = "1.0.15"
|
||||
ratio_ops = { path = "../ratio_ops", optional = true }
|
||||
|
@ -215,7 +215,7 @@ macro_rules! impl_divide_operator_not_const_generic {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(all(not(feature="wide-mul"),not(feature="ratio")))]
|
||||
#[cfg(all(not(feature="wide-mul"),not(feature="deferred-division")))]
|
||||
impl_multiplicative_operator_not_const_generic!(($struct, $trait, $method, $output ), $width);
|
||||
};
|
||||
}
|
||||
@ -273,11 +273,11 @@ impl_multiplicative_assign_operator!( Fixed, MulAssign, mul_assign );
|
||||
impl_multiplicative_operator!( Fixed, Mul, mul, Self );
|
||||
impl_multiplicative_assign_operator!( Fixed, DivAssign, div_assign );
|
||||
impl_multiplicative_operator!( Fixed, Div, div, Self );
|
||||
#[cfg(feature="ratio")]
|
||||
#[cfg(feature="deferred-division")]
|
||||
impl<const LHS_N:usize,const LHS_F:usize,const RHS_N:usize,const RHS_F:usize> core::ops::Div<Fixed<RHS_N,RHS_F>> for Fixed<LHS_N,LHS_F>{
|
||||
type Output=crate::ratio::Ratio<Fixed<LHS_N,LHS_F>,Fixed<RHS_N,RHS_F>>;
|
||||
type Output=ratio_ops::ratio::Ratio<Fixed<LHS_N,LHS_F>,Fixed<RHS_N,RHS_F>>;
|
||||
fn div(self, other: Fixed<RHS_N,RHS_F>)->Self::Output{
|
||||
crate::ratio::Ratio::new(self,other)
|
||||
ratio_ops::ratio::Ratio::new(self,other)
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ macro_rules! impl_wide_operators{
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature="ratio"))]
|
||||
#[cfg(not(feature="deferred-division"))]
|
||||
impl core::ops::Div<Fixed<$rhs,{$rhs*32}>> for Fixed<$lhs,{$lhs*32}>{
|
||||
type Output=Fixed<{$lhs+$rhs},{($lhs+$rhs)*32}>;
|
||||
fn div(self, other: Fixed<$rhs,{$rhs*32}>)->Self::Output{
|
||||
|
@ -3,8 +3,6 @@ pub mod types;
|
||||
|
||||
#[cfg(feature="zeroes")]
|
||||
pub mod zeroes;
|
||||
#[cfg(feature="ratio")]
|
||||
pub mod ratio;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
7
linear_ops/Cargo.lock
generated
7
linear_ops/Cargo.lock
generated
@ -21,10 +21,11 @@ dependencies = [
|
||||
"arrayvec",
|
||||
"bnum",
|
||||
"paste",
|
||||
"ratio_ops",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lin_ops"
|
||||
name = "linear_ops"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fixed_wide",
|
||||
@ -35,3 +36,7 @@ name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "ratio_ops"
|
||||
version = "0.1.0"
|
||||
|
1
ratio_ops/.gitignore
vendored
Normal file
1
ratio_ops/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
7
ratio_ops/Cargo.lock
generated
Normal file
7
ratio_ops/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "ratio_ops"
|
||||
version = "0.1.0"
|
6
ratio_ops/Cargo.toml
Normal file
6
ratio_ops/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "ratio_ops"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
1
ratio_ops/src/lib.rs
Normal file
1
ratio_ops/src/lib.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod ratio;
|
Loading…
Reference in New Issue
Block a user