From 98b3e33a5590c3ff11f156997f8f2c45d8dc48e0 Mon Sep 17 00:00:00 2001 From: Kevin Petit Date: Tue, 16 May 2023 09:13:50 +0100 Subject: Replace uint6_t with int8_t Add REQUIRE statements to constrain the range where needed. Also fix a typo. Change-Id: I281e6249d8951b4cb3ff19eaf199660bed3feac9 Signed-off-by: Kevin Petit --- chapters/introduction.adoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'chapters/introduction.adoc') diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc index 66bc9bf..c0b0874 100644 --- a/chapters/introduction.adoc +++ b/chapters/introduction.adoc @@ -544,7 +544,7 @@ The values to achieve a scaling of 1.0 are shift=30, multiplier=1<<30 for apply_ [source,c++] ---- -int32_t apply_scale_32(int32_t value, int32_t multiplier, uint6_t shift, bool_t double_round=false) { +int32_t apply_scale_32(int32_t value, int32_t multiplier, int8_t shift, bool_t double_round=false) { REQUIRE(multiplier >= 0); REQUIRE(2 <= shift && shift <= 62); REQUIRE(value >= (-1 << (shift - 1)) && value < (1 << (shift - 1)); @@ -559,7 +559,7 @@ int32_t apply_scale_32(int32_t value, int32_t multiplier, uint6_t shift, bool_t return (int32_t)result; } -int32_t apply_scale_16(int48_t value, int16_t multipler, uint6_t shift) { +int32_t apply_scale_16(int48_t value, int16_t multipler, int8_t shift) { REQUIRE(multiplier >= 0); REQUIRE(2 <= shift && shift <= 62); int64_t round = (1 << (shift - 1)); @@ -576,7 +576,7 @@ In some functions, the multiplier and shift are combined into a scale_t structur ---- typedef struct { int32_t multiplier; - uint6_t shift; + int8_t shift; } scale_t; ---- @@ -652,4 +652,4 @@ void generate_lookup_table(int16_t *table, int32_t (*reference)(int32_t)) The following publications are referred to in this specification, or provide more information: -. IEEE Std 754-2008, _IEEE Standard for Floating-point Arithmetic_, August 2008. \ No newline at end of file +. IEEE Std 754-2008, _IEEE Standard for Floating-point Arithmetic_, August 2008. -- cgit v1.2.1