diff options
author | Eric Kunze <eric.kunze@arm.com> | 2024-01-22 16:54:29 -0800 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2024-01-25 13:19:44 -0800 |
commit | 608588390a90e6e337a592b62cf811d1ea8ea0fd (patch) | |
tree | ce73d71540cf6e58fb94b6a12b90d5c8c04cdd4c /pseudocode/operators/RESCALE.tosac | |
parent | 0808d63e4db076fbbd02e806272ae4ccae6ed72c (diff) | |
download | specification-608588390a90e6e337a592b62cf811d1ea8ea0fd.tar.gz |
Handle CAST from fp-type to narrow integer types
Be explicit that the value is converted to int32 and then clamped to the
output type range.
Also remove use of apply_clip, replacing with either apply_clip_s or apply_clip_u
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Change-Id: I0efc7f4d653c1bef13c9989cfe2647208dad9617
Diffstat (limited to 'pseudocode/operators/RESCALE.tosac')
-rw-r--r-- | pseudocode/operators/RESCALE.tosac | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pseudocode/operators/RESCALE.tosac b/pseudocode/operators/RESCALE.tosac index c29bddd..3ebb8d6 100644 --- a/pseudocode/operators/RESCALE.tosac +++ b/pseudocode/operators/RESCALE.tosac @@ -43,14 +43,14 @@ for_each(index in shape) { if (output_unsigned) { int32_t extended_out_zp = zero_extend<int32_t>(output_zp); result = apply_add_s<int32_t>(result, extended_out_zp); - out_t out = static_cast<out_t>(apply_clip<int32_t>(result, + out_t out = static_cast<out_t>(apply_clip_u<i32_t>(result, minimum_u<out_t>, maximum_u<out_t>)); } else { int32_t extended_out_zp = sign_extend<int32_t>(output_zp); result = apply_add_s<int32_t>(result, extended_out_zp); - out_t out = static_cast<out_t>(apply_clip<int32_t>(result, + out_t out = static_cast<out_t>(apply_clip_s<i32_t>(result, minimum_s<out_t>, maximum_s<out_t>)); } |