| author | |
| committer | |
| log | 4942e4e8701b9a137d7f30fcb8ac1bc2d46f2a99 |
| tree | 35ad35e77e2f9266e4b1bbff873d1adfe378e23e |
| parent | adc6dec26b8ba9f79aabc4b69ae689acf4c6767d |
| signature |
In 41 (Undefined Behavior) . 5 (Integer Overflow) . 3 (Builtin Overflow Functions), it is stated that
> These builtins return a bool of whether or not overflow occurred, as well as returning the overflowed bits:
> * @addWithOverflow
> * @subWithOverflow
> * @mulWithOverflow
> * @shlWithOverflow
but in their definition says that it returns a `tuple`/`struct`.
Example;
`@addWithOverflow(a: anytype, b: anytype) struct { @TypeOf(a, b), u1 }`
Co-authored-by: zooster <r00ster91@proton.me>1 files changed, 2 insertions(+), 2 deletions(-)
doc/langref.html.in+2-2| ... | ... | @@ -9804,8 +9804,8 @@ pub fn main() !void { |
| 9804 | 9804 | {#header_close#} |
| 9805 | 9805 | {#header_open|Builtin Overflow Functions#} |
| 9806 | 9806 | <p> |
| 9807 | These builtins return a {#syntax#}bool{#endsyntax#} of whether or not overflow | |
| 9808 | occurred, as well as returning the overflowed bits: | |
| 9807 | These builtins return a tuple containing whether there was an overflow | |
| 9808 | (as a {#syntax#}u1{#endsyntax#}) and the possibly overflowed bits of the operation: | |
| 9809 | 9809 | </p> |
| 9810 | 9810 | <ul> |
| 9811 | 9811 | <li>{#link|@addWithOverflow#}</li> |