Skip to content

Commit aa40069

Browse files
committed
fixed incorrect usage of "underflow"
1 parent a57ad94 commit aa40069

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎docs/stdlib.json‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,14 @@
340340
"section": "`u8` arithmetic",
341341
"input_type": "u8, u8",
342342
"output_type": "Option<u8>",
343-
"description": "Subtract the second `u8` value from the first. Return `Some` of the difference, or `None` if the result would underflow `u8`."
343+
"description": "Subtract the second `u8` value from the first. Return `Some` of the difference, or `None` if the result would overflow `u8`."
344344
},
345345
{
346346
"simplicityhl_name": "safe_sub_8",
347347
"section": "`u8` arithmetic",
348348
"input_type": "u8, u8",
349349
"output_type": "u8",
350-
"description": "Subtract the second `u8` value from the first.\n\n## Panics\nPanics if the result would underflow `u8`."
350+
"description": "Subtract the second `u8` value from the first.\n\n## Panics\nPanics if the result would overflow `u8`."
351351
},
352352
{
353353
"simplicityhl_name": "checked_mul_8",
@@ -466,14 +466,14 @@
466466
"section": "`u16` arithmetic",
467467
"input_type": "u16, u16",
468468
"output_type": "Option<u16>",
469-
"description": "Subtract the second `u16` value from the first. Return `Some` of the difference, or `None` if the result would underflow `u16`."
469+
"description": "Subtract the second `u16` value from the first. Return `Some` of the difference, or `None` if the result would overflow `u16`."
470470
},
471471
{
472472
"simplicityhl_name": "safe_sub_16",
473473
"section": "`u16` arithmetic",
474474
"input_type": "u16, u16",
475475
"output_type": "u16",
476-
"description": "Subtract the second `u16` value from the first.\n\n## Panics\nPanics if the result would underflow `u16`."
476+
"description": "Subtract the second `u16` value from the first.\n\n## Panics\nPanics if the result would overflow `u16`."
477477
},
478478
{
479479
"simplicityhl_name": "checked_mul_16",
@@ -592,14 +592,14 @@
592592
"section": "`u32` arithmetic",
593593
"input_type": "u32, u32",
594594
"output_type": "Option<u32>",
595-
"description": "Subtract the second `u32` value from the first. Return `Some` of the difference, or `None` if the result would underflow `u32`."
595+
"description": "Subtract the second `u32` value from the first. Return `Some` of the difference, or `None` if the result would overflow `u32`."
596596
},
597597
{
598598
"simplicityhl_name": "safe_sub_32",
599599
"section": "`u32` arithmetic",
600600
"input_type": "u32, u32",
601601
"output_type": "u32",
602-
"description": "Subtract the second `u32` value from the first.\n\n## Panics\nPanics if the result would underflow `u32`."
602+
"description": "Subtract the second `u32` value from the first.\n\n## Panics\nPanics if the result would overflow `u32`."
603603
},
604604
{
605605
"simplicityhl_name": "checked_mul_32",
@@ -725,14 +725,14 @@
725725
"section": "`u64` arithmetic",
726726
"input_type": "u64, u64",
727727
"output_type": "Option<u64>",
728-
"description": "Subtract the second `u64` value from the first. Return `Some` of the difference, or `None` if the result would underflow `u64`."
728+
"description": "Subtract the second `u64` value from the first. Return `Some` of the difference, or `None` if the result would overflow `u64`."
729729
},
730730
{
731731
"simplicityhl_name": "safe_sub_64",
732732
"section": "`u64` arithmetic",
733733
"input_type": "u64, u64",
734734
"output_type": "u64",
735-
"description": "Subtract the second `u64` value from the first.\n\n## Panics\nPanics if the result would underflow `u64`."
735+
"description": "Subtract the second `u64` value from the first.\n\n## Panics\nPanics if the result would overflow `u64`."
736736
},
737737
{
738738
"simplicityhl_name": "checked_mul_64",
@@ -886,14 +886,14 @@
886886
"section": "`u128` arithmetic",
887887
"input_type": "u128, u128",
888888
"output_type": "Option<u128>",
889-
"description": "Subtract the second `u128` value from the first. Return `Some` of the difference, or `None` if the result would underflow `u128`."
889+
"description": "Subtract the second `u128` value from the first. Return `Some` of the difference, or `None` if the result would overflow `u128`."
890890
},
891891
{
892892
"simplicityhl_name": "safe_sub_128",
893893
"section": "`u128` arithmetic",
894894
"input_type": "u128, u128",
895895
"output_type": "u128",
896-
"description": "Subtract the second `u128` value from the first.\n\n## Panics\nPanics if the result would underflow `u128`."
896+
"description": "Subtract the second `u128` value from the first.\n\n## Panics\nPanics if the result would overflow `u128`."
897897
},
898898
{
899899
"simplicityhl_name": "mul_128",
@@ -1173,14 +1173,14 @@
11731173
"section": "`u256` arithmetic",
11741174
"input_type": "u256, u256",
11751175
"output_type": "Option<u256>",
1176-
"description": "Subtract the second `u256` value from the first. Return `Some` of the difference, or `None` if the result would underflow `u256`."
1176+
"description": "Subtract the second `u256` value from the first. Return `Some` of the difference, or `None` if the result would overflow `u256`."
11771177
},
11781178
{
11791179
"simplicityhl_name": "safe_sub_256",
11801180
"section": "`u256` arithmetic",
11811181
"input_type": "u256, u256",
11821182
"output_type": "u256",
1183-
"description": "Subtract the second `u256` value from the first.\n\n## Panics\nPanics if the result would underflow `u256`."
1183+
"description": "Subtract the second `u256` value from the first.\n\n## Panics\nPanics if the result would overflow `u256`."
11841184
},
11851185
{
11861186
"simplicityhl_name": "mul_256",

‎simf/lib/u128/math.simf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ pub fn div_mod_128(a: u128, b: u128) -> (u128, u128) {
351351
match jet::eq_64(a_high, b_high) {
352352
true => {
353353
// safe: !lt_128(a, b) and a_high == b_high, so a_low >= b_low,
354-
// and the subtraction can not underflow
354+
// and the subtraction can not overflow
355355
let (_, diff): (bool, u64) = jet::subtract_64(a_low, b_low);
356356
(1, u64_to_u128(diff))
357357
},

‎simf/lib/u256/math.simf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ pub fn div_mod_256(a: u256, b: u256) -> (u256, u256) {
463463
match eq_128(a_high, b_high) {
464464
true => {
465465
// safe: !lt_256(a, b) and a_high == b_high, so a_low >= b_low,
466-
// and the subtraction can not underflow
466+
// and the subtraction can not overflow
467467
let (_, diff): (bool, u128) = sub_128(a_low, b_low);
468468
(1, u128_to_u256(diff))
469469
},

0 commit comments

Comments
 (0)