diff options
author | Kevin Petit <kevin.petit@arm.com> | 2024-02-08 10:29:43 +0000 |
---|---|---|
committer | Kevin Petit <kevin.petit@arm.com> | 2024-02-08 10:29:43 +0000 |
commit | 599de076047aae846fd28cc52a777e4b6e534aaf (patch) | |
tree | b8eab10e9cab319d9023b141480e2cd82486c0af /pseudocode/library/arithmetic_helpers.tosac | |
parent | c65cd9ccff6000be01ee0742319009f0061879ce (diff) | |
download | specification-599de076047aae846fd28cc52a777e4b6e534aaf.tar.gz |
pseudocode: use function call syntax to call templated functions
Change-Id: I24409a38aaf4818a9ab0abc0cad5c7d052e01bd1
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Diffstat (limited to 'pseudocode/library/arithmetic_helpers.tosac')
-rw-r--r-- | pseudocode/library/arithmetic_helpers.tosac | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/pseudocode/library/arithmetic_helpers.tosac b/pseudocode/library/arithmetic_helpers.tosac index be82ef5..1b8de0f 100644 --- a/pseudocode/library/arithmetic_helpers.tosac +++ b/pseudocode/library/arithmetic_helpers.tosac @@ -8,16 +8,16 @@ // by a licensing agreement from ARM Limited. in_t apply_add_s<in_t>(in_t a, in_t b) { - if (is_floating_point(in_t)) return a + b; + if (is_floating_point<in_t>()) return a + b; int64_t c = sign_extend<int64_t>(a) + sign_extend<int64_t>(b); - REQUIRE(c >= minimum_s<in_t> && c <= maximum_s<in_t>); + REQUIRE(c >= minimum_s<in_t>() && c <= maximum_s<in_t>()); return static_cast<in_t>(c); } in_t apply_add_u<in_t>(in_t a, in_t b) { - if (is_floating_point(in_t)) return a + b; + if (is_floating_point<in_t>()) return a + b; uint64_t c = zero_extend<uint64_t>(a) + zero_extend<uint64_t>(b); - REQUIRE(c >= minimum_u<in_u_t> && c <= maximum_u<in_u_t>); + REQUIRE(c >= minimum_u<in_u_t>() && c <= maximum_u<in_u_t>()); return truncate<in_t>(c); } @@ -28,7 +28,7 @@ in_t apply_arith_rshift<in_t>(in_t a, in_t b) { in_t apply_intdiv_s<in_t>(in_t a, in_t b) { int64_t c = sign_extend<int64_t>(a) / sign_extend<int64_t>(b); - REQUIRE(c >= minimum_s<in_t> && c <= maximum_s<in_t>); + REQUIRE(c >= minimum_s<in_t>() && c <= maximum_s<in_t>()); return static_cast<in_t>(c); } @@ -37,7 +37,7 @@ in_t apply_ceil<in_t>(in_t input) { } in_t apply_clip_s<in_t>(in_t value, in_t min_val, in_t max_val) { - if (is_floating_point(in_t>) { + if (is_floating_point<in_t>()) { REQUIRE(min_val <= max_val); } else { @@ -79,7 +79,7 @@ in_t apply_logical_rshift<in_t>(in_t a, in_t b) { } in_t apply_max_s<in_t>(in_t a, in_t b) { - if (is_floating_point(in_t)) { + if (is_floating_point<in_t>()) { if (isNaN(a) || isNaN(b)) { return NaN; } @@ -94,7 +94,7 @@ in_t apply_max_u<in_t>(in_t a, in_t b) { } in_t apply_min_s<in_t>(in_t a, in_t b) { - if (is_floating_point(in_t)) { + if (is_floating_point<in_t>()) { if (isNaN(a) || isNaN(b)) { return NaN; } @@ -109,7 +109,7 @@ in_t apply_min_u<in_t>(in_t a, in_t b) { } in_t apply_mul_s<in_t>(in_t a, in_t b) { - if (is_floating_point(in_t)) return a * b; + if (is_floating_point<in_t>()) return a * b; int64_t c = sign_extend<int64_t>(a) * sign_extend<int64_t>(b); return static_cast<in_t>(c); } @@ -123,15 +123,15 @@ in_t apply_sqrt<in_t>(in_t input) { } in_t apply_sub_s<in_t>(in_t a, in_t b) { - if (is_floating_point(in_t)) return a - b; + if (is_floating_point<in_t>()) return a - b; int64_t c = sign_extend<int64_t>(a) - sign_extend<int64_t>(b); - REQUIRE(c >= minimum_s<in_t> && c <= maximum_s<in_t>); + REQUIRE(c >= minimum_s<in_t>() && c <= maximum_s<in_t>()); return static_cast<in_t>(c); } in_t apply_sub_u<in_t>(in_t a, in_t b) { uint64_t c = zero_extend<uint64_t>(a) - zero_extend<uint64_t>(b); - REQUIRE(c >= minimum_u<in_u_t> && c <= maximum_u<in_u_t>); + REQUIRE(c >= minimum_u<in_u_t>() && c <= maximum_u<in_u_t>()); return truncate<in_t>(c); } |