diff options
author | Kevin Petit <kevin.petit@arm.com> | 2024-02-08 11:03:26 +0000 |
---|---|---|
committer | Kevin Petit <kevin.petit@arm.com> | 2024-02-15 10:14:44 +0000 |
commit | 667e62897a809ab3af832e7778139d3869532277 (patch) | |
tree | 1d8faf7336ca9335792f76becf19d9b20b33d82a /pseudocode/library/generic_helpers.tosac | |
parent | 1f05883799957300ea88d7ec314a5897e6c0ccb1 (diff) | |
download | specification-667e62897a809ab3af832e7778139d3869532277.tar.gz |
pseudocode: use function declaration syntax for library functions that are not defined
Also:
- Add missing semicolon
- Fix prototype for is_floating_point to use template syntax
Change-Id: I9ec1c687a3854b73ddac78f4db0db8e10f4e10e6
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Diffstat (limited to 'pseudocode/library/generic_helpers.tosac')
-rw-r--r-- | pseudocode/library/generic_helpers.tosac | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/pseudocode/library/generic_helpers.tosac b/pseudocode/library/generic_helpers.tosac index a2fdbe0..eabc9b2 100644 --- a/pseudocode/library/generic_helpers.tosac +++ b/pseudocode/library/generic_helpers.tosac @@ -7,13 +7,13 @@ // copies and copies may only be made to the extent permitted // by a licensing agreement from ARM Limited. -bool_t is_floating_point(type) { +bool_t is_floating_point<type>() { if (type == fp16_t || type == fp32_t || type == bf16_t || type == fp8e4m3_t || type == fp8e5m2_t) return true; return false; } -bool_t is_saturating_float_type(type) { +bool_t is_saturating_float_type<type>() { // Saturate for the fp8 formats, all other floats do not saturate if (type == fp8e4m3_t || type == fp8e5m2_t) { return true; @@ -43,38 +43,38 @@ int32_t idiv_floor(int32_t input1, int32_t input2) { return rval; } -int32_t length(in_t input) - return number of elements in input list +// return number of elements in input list +int32_t length(in_t input); -int32_t rank(in_t input) - return rank of an input tensor +// return rank of an input tensor +int32_t rank(in_t input); -int32_t sum(in_t input[]) - return the sum of values of an input list +// return the sum of values of an input list +int32_t sum(in_t input[]); -bool isNaN(float input) - return True if floating-point input value is NaN +// return True if floating-point input value is NaN +bool_t isNaN(float input); -float_t pi() - returns value of pi +// returns value of pi +float_t pi(); -float_t sin(angle) - return sine of angle given in radians +// return sine of angle given in radians +float_t sin(float_t angle); -float_t cos(angle) - return cosine of angle given in radians +// return cosine of angle given in radians +float_t cos(float_t angle); -bool power_of_two(int32_t value) - return true if value is a power of two, false otherwise +// return true if value is a power of two, false otherwise +bool_t power_of_two(int32_t value); -in_out_t maximum_s<Type T> - return the maximum value when interpreting type T as a signed value as returned by the make_signed helper. +// return the maximum value when interpreting type in_out_t as a signed value as returned by the make_signed helper. +in_out_t maximum_s<in_out_t>(); -in_out_t minimum_s<Type T> - return the minimum value when interpreting type T as a signed value as returned by the make_signed helper. +// return the minimum value when interpreting type in_out_t as a signed value as returned by the make_signed helper. +in_out_t minimum_s<in_out_t>(); -in_out_t maximum_u<Type T> - return the maximum value when interpreting type T as an unsigned value as returned by the make_unsigned helper. +// return the maximum value when interpreting type in_out_t as an unsigned value as returned by the make_unsigned helper. +in_out_t maximum_u<in_out_t>(); -in_out_t minimum_u<Type T> - return the minimum value when interpreting type T as an unsigned value as returned by the make_unsigned helper. +// return the minimum value when interpreting type in_out_t as an unsigned value as returned by the make_unsigned helper. +in_out_t minimum_u<in_out_t>(); |