From 608588390a90e6e337a592b62cf811d1ea8ea0fd Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Mon, 22 Jan 2024 16:54:29 -0800 Subject: 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 Change-Id: I0efc7f4d653c1bef13c9989cfe2647208dad9617 --- chapters/introduction.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chapters/introduction.adoc') diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc index 8b5be21..ae5c7b1 100644 --- a/chapters/introduction.adoc +++ b/chapters/introduction.adoc @@ -739,7 +739,7 @@ void generate_lookup_table(int16_t *table, int32_t (*reference)(int32_t)) { for (int i = -256; i <= 256; i++) { int32_t value = (*reference)(i); - table[i + 256] = static_cast(apply_clip(value, -32768, +32767)); + table[i + 256] = static_cast(apply_clip_s(value, -32768, +32767)); } } ---- -- cgit v1.2.1