File: README

package info (click to toggle)
hare 0.25.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,948 kB
  • sloc: asm: 1,264; makefile: 123; sh: 114; lisp: 101
file content (14 lines) | stat: -rw-r--r-- 479 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
checked: overflow-checked integer arithmetic

The functions add*, sub* and mul* perform wrapping integer arithmetic, with the
same semantics as the +, -, and * operators.

	const (res, overflow) = math::addi32(types::I32_MAX, 1);
	assert(res == types::I32_MIN);
	assert(overflow);

The functions sat_* perform saturating integer arithmetic, which clamp the
result value to the range of the type.

	const res = math::sat_addi32(types::I32_MAX, 1);
	assert(res == types::I32_MAX);