File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,6 @@ pub trait Address:
53
53
/// Get the raw value of the address.
54
54
fn raw_value ( & self ) -> Self :: V ;
55
55
56
- /// Returns the bitwise and of the address with the given mask.
57
- fn mask ( & self , mask : Self :: V ) -> Self :: V {
58
- self . raw_value ( ) & mask
59
- }
60
-
61
56
/// Returns the offset from this address to the given base address.
62
57
/// Only use this when `base` is guaranteed not to overflow.
63
58
fn unchecked_offset_from ( & self , base : Self ) -> Self :: V {
@@ -195,4 +190,23 @@ mod tests {
195
190
assert_eq ! ( Some ( GuestAddress ( 0x0f ) ) , a. checked_sub( 0xf0 ) ) ;
196
191
assert ! ( a. checked_sub( 0xffff ) . is_none( ) ) ;
197
192
}
193
+
194
+ #[ test]
195
+ fn default ( ) {
196
+ assert_eq ! ( GuestAddress :: default ( ) , GuestAddress ( 0 ) ) ;
197
+ }
198
+
199
+ #[ test]
200
+ fn and ( ) {
201
+ let a = GuestAddress ( 0x00 ) ;
202
+ let b = GuestAddress ( 0xff ) ;
203
+ assert_eq ! ( a & b. raw_value( ) , a) ;
204
+ }
205
+
206
+ #[ test]
207
+ fn or ( ) {
208
+ let a = GuestAddress ( 0x00 ) ;
209
+ let b = GuestAddress ( 0xff ) ;
210
+ assert_eq ! ( a | b. raw_value( ) , b) ;
211
+ }
198
212
}
You can’t perform that action at this time.
0 commit comments