mirror of
https://github.com/kmc7468/cs220.git
synced 2025-12-12 21:08:45 +00:00
Assignment 1 Done
This commit is contained in:
@@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
/// Adds two unsigned words. If overflow happens, just wrap around.
|
/// Adds two unsigned words. If overflow happens, just wrap around.
|
||||||
pub fn add(lhs: usize, rhs: usize) -> usize {
|
pub fn add(lhs: usize, rhs: usize) -> usize {
|
||||||
todo!()
|
lhs.wrapping_add(rhs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subtracts two unsigned words. If overflow happens, just wrap around.
|
/// Subtracts two unsigned words. If overflow happens, just wrap around.
|
||||||
pub fn sub(lhs: usize, rhs: usize) -> usize {
|
pub fn sub(lhs: usize, rhs: usize) -> usize {
|
||||||
todo!()
|
lhs.wrapping_sub(rhs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user