-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Ref type for {BigInt|BigUint} #283
Comments
The internal layout of It may be more feasible to support
For any ops that would work on such |
For the BigDecimal crate I added a pub struct BigDecimalRef<'a> {
sign: Sign,
digits: &'a BigUint,
scale: i64,
} All the (non-mutable) methods need to be duplicated for the Ref struct (or rather moved, as the The suggested implementation would work: #[derive(Clone,Copy)]
pub struct BigIntRef<'a> {
sign: Sign,
mag: BigUintRef<'a>,
}
#[derive(Clone,Copy)]
pub struct BigUintRef<'a> {
data: &'a [BigDigit];
} A mutable With such a ref struct, I'd be able to change my impl to: pub struct BigDecimalRef<'a> {
sign: Sign,
digits: BigUintRef<'a>,
scale: i64,
} So the ref would contain the slice, rather than reference to the uint which contains the vector. |
Propose to introduce the
BigIntRef
andBigUintRef
type, and the definition should be:And implement all ops on them.
The feature is useful when we want to store a list of BigInt or BigUint in a flatten memory and apply op on them without a whole clone.
The text was updated successfully, but these errors were encountered: