sign_extend32(9)
β¨ sign_extend32 β¨
okay bestie so this is a page from the Kernel API Manual π and it's literally about sign_extend32 β yes it's exactly as iconic as it sounds π
πΈ NAME πΈ
sign_extend32 β sign extend a 32-bit value using specified bit as sign-bit π
π¦ SYNOPSIS π¦
__s32 sign_extend32 (__u32 value , int index );
π ARGUMENTS π
valueβ the value you want to sign extend, periodt β¨indexβ the 0 based bit index (0 <= index < 32) that you're treating as the sign bit π
π§ DESCRIPTION π§
so like the whole point: this one is safe to use for 16- and 8-bit types as well π«Ά no cap, it just works.
β RETURN β
it gives you back a 32-bit sign extended value π that's the whole moment.
π SEE ALSO π
Kernel file ./include/linux/bitops.h β and the whole friend group:
rol64(9),ror64(9),rol32(9),ror32(9),rol16(9),ror16(9),rol8(9),ror8(9),sign_extend64(9),get_count_order_long(9),parity8(9),__ffs64(9),fns(9),assign_bit(9),__ptr_set_bit(9),__ptr_clear_bit(9),__ptr_test_bit(9)
lowkey a whole squad of bit twiddlers, go say hi π
okay that's the page!! π from ./include/linux, dated October 2026, and it signs off as sign_extend32(9) β mwah, slay, bye bestie ππ₯
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms