diff options
author | Dominic Symes <dominic.symes@arm.com> | 2022-01-27 15:44:26 +0000 |
---|---|---|
committer | Dominic Symes <dominic.symes@arm.com> | 2022-02-03 14:31:16 +0000 |
commit | 2ff79fe6b31f41685cf2cecfca5410db40440aaf (patch) | |
tree | cc07ddf226cd8f226495188be20a1e2b983c27c6 /chapters | |
parent | 3cb753569ae8724c1e29e506f67de25b97762667 (diff) | |
download | specification-2ff79fe6b31f41685cf2cecfca5410db40440aaf.tar.gz |
TABLE: Clarify the interpolation slope range
The interpolation slope must not exceed
int16_t range.
Signed-off-by: Dominic Symes <dominic.symes@arm.com>
Change-Id: Ic9037dcc11c293c78b9398952118a129e3be66f5
Diffstat (limited to 'chapters')
-rw-r--r-- | chapters/introduction.adoc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc index 51247bc..2827399 100644 --- a/chapters/introduction.adoc +++ b/chapters/introduction.adoc @@ -444,7 +444,9 @@ int32_t apply_lookup(int16_t *table, int32_t value) int32_t fraction = clipped_value & 0x7f; int16_t base = table[index]; int16_t next = table[index+1]; - int32_t return_value = (base << 7) + (next - base) * fraction; + int32_t slope = next - base; + REQUIRE(slope >= minimum<int16_t> && slope <= maximum<int16_t>) + int32_t return_value = (base << 7) + slope * fraction; return return_value; // return interpolated value of 16 + 7 = 23 bits } ---- |