[del] Implement additions for PhysAddr
This commit is contained in:
parent
8dc3586b55
commit
9638ddbb3e
|
@ -2,6 +2,7 @@
|
||||||
* SPDX-License-Identifier: BlueOak-1.0.0
|
* SPDX-License-Identifier: BlueOak-1.0.0
|
||||||
* Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
* Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||||
*/
|
*/
|
||||||
|
use core::ops::{Shl, Shr};
|
||||||
use {
|
use {
|
||||||
crate::mm::{align_down, align_up},
|
crate::mm::{align_down, align_up},
|
||||||
bit_field::BitField,
|
bit_field::BitField,
|
||||||
|
@ -489,6 +490,22 @@ impl Sub<PhysAddr> for PhysAddr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Shr<usize> for PhysAddr {
|
||||||
|
type Output = PhysAddr;
|
||||||
|
|
||||||
|
fn shr(self, shift: usize) -> Self::Output {
|
||||||
|
PhysAddr::new(self.0 >> shift)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Shl<usize> for PhysAddr {
|
||||||
|
type Output = PhysAddr;
|
||||||
|
|
||||||
|
fn shl(self, shift: usize) -> Self::Output {
|
||||||
|
PhysAddr::new(self.0 << shift)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
// use super::*;
|
// use super::*;
|
||||||
|
|
Loading…
Reference in New Issue