@@ -89,13 +89,13 @@ impl VirtAddr {
89
89
90
90
/// Creates a virtual address from the given pointer
91
91
pub fn from_ptr < T > ( ptr : * const T ) -> Self {
92
- Self :: new ( cast :: u64 ( ptr as usize ) )
92
+ Self :: new ( ptr as u64 )
93
93
}
94
94
95
95
/// Converts the address to a raw pointer.
96
96
#[ cfg( target_pointer_width = "64" ) ]
97
97
pub fn as_ptr < T > ( self ) -> * const T {
98
- cast :: usize ( self . as_u64 ( ) ) as * const T
98
+ self . as_u64 ( ) as * const T
99
99
}
100
100
101
101
/// Converts the address to a mutable raw pointer.
@@ -181,14 +181,14 @@ impl AddAssign<u64> for VirtAddr {
181
181
impl Add < usize > for VirtAddr {
182
182
type Output = Self ;
183
183
fn add ( self , rhs : usize ) -> Self :: Output {
184
- self + cast :: u64 ( rhs)
184
+ self + rhs as u64
185
185
}
186
186
}
187
187
188
188
#[ cfg( target_pointer_width = "64" ) ]
189
189
impl AddAssign < usize > for VirtAddr {
190
190
fn add_assign ( & mut self , rhs : usize ) {
191
- self . add_assign ( cast :: u64 ( rhs) )
191
+ self . add_assign ( rhs as u64 )
192
192
}
193
193
}
194
194
@@ -209,14 +209,14 @@ impl SubAssign<u64> for VirtAddr {
209
209
impl Sub < usize > for VirtAddr {
210
210
type Output = Self ;
211
211
fn sub ( self , rhs : usize ) -> Self :: Output {
212
- self - cast :: u64 ( rhs)
212
+ self - rhs as u64
213
213
}
214
214
}
215
215
216
216
#[ cfg( target_pointer_width = "64" ) ]
217
217
impl SubAssign < usize > for VirtAddr {
218
218
fn sub_assign ( & mut self , rhs : usize ) {
219
- self . sub_assign ( cast :: u64 ( rhs) )
219
+ self . sub_assign ( rhs as u64 )
220
220
}
221
221
}
222
222
@@ -347,14 +347,14 @@ impl AddAssign<u64> for PhysAddr {
347
347
impl Add < usize > for PhysAddr {
348
348
type Output = Self ;
349
349
fn add ( self , rhs : usize ) -> Self :: Output {
350
- self + cast :: u64 ( rhs)
350
+ self + rhs as u64
351
351
}
352
352
}
353
353
354
354
#[ cfg( target_pointer_width = "64" ) ]
355
355
impl AddAssign < usize > for PhysAddr {
356
356
fn add_assign ( & mut self , rhs : usize ) {
357
- self . add_assign ( cast :: u64 ( rhs) )
357
+ self . add_assign ( rhs as u64 )
358
358
}
359
359
}
360
360
@@ -375,14 +375,14 @@ impl SubAssign<u64> for PhysAddr {
375
375
impl Sub < usize > for PhysAddr {
376
376
type Output = Self ;
377
377
fn sub ( self , rhs : usize ) -> Self :: Output {
378
- self - cast :: u64 ( rhs)
378
+ self - rhs as u64
379
379
}
380
380
}
381
381
382
382
#[ cfg( target_pointer_width = "64" ) ]
383
383
impl SubAssign < usize > for PhysAddr {
384
384
fn sub_assign ( & mut self , rhs : usize ) {
385
- self . sub_assign ( cast :: u64 ( rhs) )
385
+ self . sub_assign ( rhs as u64 )
386
386
}
387
387
}
388
388
0 commit comments