From cb6c6b33cc85d6c40d46b1ee78bcbd6a049017d5 Mon Sep 17 00:00:00 2001 From: Dominic Symes Date: Fri, 29 Apr 2022 16:15:56 +0100 Subject: Specify width of integer types Clarify for types previously definded as int the width assumed by the specification. Signed-off-by: Dominic Symes Change-Id: Ied62d4803a4323a600d33cff09752a76ca48f18d --- 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 fe4f724..4263135 100644 --- a/chapters/introduction.adoc +++ b/chapters/introduction.adoc @@ -405,7 +405,7 @@ In places where a divide is required, we also use the function below to calculat scale_t reciprocal_scale(uint32_t value) { REQUIRE(value > 0); scale_t scale; - int k = 32 - count_leading_zeros(value - 1); // (1 << k) / 2 < value <= (1 << k) + int32_t k = 32 - count_leading_zeros(value - 1); // (1 << k) / 2 < value <= (1 << k) int64_t numerator = ((1 << 30) + 1) << k; scale.multiplier = numerator / value; // (1 << 30) <= multiplier < (1 << 31) scale.shift = 30 + k; -- cgit v1.2.1