Skip to content

Commit

Permalink
refactor!(u128::safe_add): Rename snippet to safe_add
Browse files Browse the repository at this point in the history
Since it checks for and crashes on overflow, its name should reflect
that.

This closes #108.
  • Loading branch information
Sword-Smith committed Jul 10, 2024
1 parent 1e3bc49 commit 8d09230
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 226 deletions.
2 changes: 1 addition & 1 deletion tasm-lib/src/arithmetic/u128.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod add_u128;
pub mod safe_add;
pub mod safe_mul_u128;
pub mod shift_left_static_u128;
pub mod shift_left_u128;
Expand Down
223 changes: 0 additions & 223 deletions tasm-lib/src/arithmetic/u128/add_u128.rs

This file was deleted.

4 changes: 2 additions & 2 deletions tasm-lib/src/exported_snippets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use triton_vm::table::extension_table::Quotientable;
use triton_vm::table::master_table::MasterExtTable;
use triton_vm::table::NUM_QUOTIENT_SEGMENTS;

use crate::arithmetic::u128::add_u128::AddU128;
use crate::arithmetic::u128::safe_add::SafeAddU128;
use crate::arithmetic::u128::safe_mul_u128::SafeMulU128;
use crate::arithmetic::u128::shift_left_static_u128::ShiftLeftStaticU128;
use crate::arithmetic::u128::shift_left_u128::ShiftLeftU128;
Expand Down Expand Up @@ -161,7 +161,7 @@ pub fn name_to_snippet(fn_name: &str) -> Box<dyn BasicSnippet> {
"tasmlib_arithmetic_u64_overflowing_sub" => Box::new(OverflowingSub),

// u128
"tasmlib_arithmetic_u128_add" => Box::new(AddU128),
"tasmlib_arithmetic_u128_safe_add" => Box::new(SafeAddU128),
"tasmlib_arithmetic_u128_shift_left" => Box::new(ShiftLeftU128),
"tasmlib_arithmetic_u128_shift_right" => Box::new(ShiftRightU128),
"tasmlib_arithmetic_u128_sub" => Box::new(SubU128),
Expand Down

0 comments on commit 8d09230

Please sign in to comment.