base: Fix ctz32 for systems where unsigned int is not 32bit

The implementation of ctz32 uses __builtin_ctz to count the number of
trailing zeros and therefore makes the assumption that an unsigned int
is 32bit. This change checks whether that's the case and if not it
uses __builtin_ctzl instead.

Change-Id: Ic3ed3ada25fd0a93c7eb91d75b954e9924bdbb77
Signed-off-by: Nikos Nikoleris <>
Reviewed-by: Jason Lowe-Power <>
Reviewed-by: Daniel Carvalho <>
Maintainer: Jason Lowe-Power <>
Tested-by: kokoro <>
1 file changed