From e5d22a77300643f0a3013ad40ccd2b5b76788b42 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Tue, 15 Dec 2020 15:41:05 -0800 Subject: Disambiguate scale_t in RESIZE command scale_t is already defined globally for the rescaling. Move pseudocode for count_leading_zeros to introduction, and use it in the implementation of CLZ. Change-Id: I2453bce93b6dd25e870b8a010fc62af4c001cbf9 --- chapters/ewise_unary.adoc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'chapters/ewise_unary.adoc') diff --git a/chapters/ewise_unary.adoc b/chapters/ewise_unary.adoc index c64bef7..8cdce3d 100644 --- a/chapters/ewise_unary.adoc +++ b/chapters/ewise_unary.adoc @@ -122,17 +122,7 @@ Elementwise count leading zeros operation for_each (index in shape) { in_t acc = 0 in_t value1 = tensor_read(input1, shape, index) - if (value1 == 0) { - acc = 32 // input1_width - } - else { - mask = 1 << (32 - 1) // input1_width - 1 - acc = 0 - while (mask & value1 == 0) { - mask = mask >> 1 - acc = acc + 1 - } - } + acc = count_leading_zeros(value1) tensor_write(output, shape, index, acc) } ---- -- cgit v1.2.1