Skip to main content

patch_seq_clz

Function patch_seq_clz 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_clz(stack: Stack) -> Stack
Expand description

Count leading zeros, relative to the 63-bit Int width.

Stack effect: ( n – count )

clz(0) = 63. The i64::leading_zeros count is one larger than the 63-bit count for any non-negative value (the implicit sign-extension bit), and one larger for 0 as well — saturating_sub(1) collapses both cases. For negatives the i64 sign-extension bit is 1, so i64::leading_zeros is already 0.

§Safety

Stack must have one Int value on top