wrapping_add(9)
π wrapping_add(9) β a Kernel API Manual moment
okay bestie, so we're in the kernel docs, section 9, and this little icon is called wrapping_add β¨ it lives in the Kernel API Manual and it's honestly giving "small function, big responsibility."
πΈ NAME πΈ
wrapping_add β intentionally perform a wrapping addition π
like, on purpose. deliberately. not a bug, a choice. π
β¨ SYNOPSIS β¨
wrapping_add (type , a , b );
that's the whole vibe. three args, no notes. π«Ά
π ARGUMENTS π
typeβ the type you want the result of the calculation to be. yes, you literally pass the type in. main character energy. πaβ first addend πbβ second addend π
π DESCRIPTION π
so what it does is: return the potentially wrapped-around addition β without tripping any of those wrap-around sanitizers that may be enabled π₯
ngl that's the entire description and it ate. it's a "yes I know it overflows, I want it to overflow, please stop yelling at me" function. periodt. π
fr fr: the wrapping is intentional here. that's the whole point. if you're not trying to wrap, this is not your girl. π
π SEE ALSO π
Kernel file ./include/linux/overflow.h β that's where she lives, go say hi π¦
and the whole overflow friend group, no cap:
check_add_overflow(9)wrapping_assign_add(9)check_sub_overflow(9)wrapping_sub(9)wrapping_assign_sub(9)check_mul_overflow(9)wrapping_mul(9)check_shl_overflow(9)overflows_type(9)range_overflows(9)range_overflows_t(9)range_end_overflows(9)range_end_overflows_t(9)castable_to_type(9)size_mul(9)size_add(9)size_sub(9)array_size(9)array3_size(9)flex_array_size(9)struct_size(9)struct_size_t(9)struct_offset(9)__DEFINE_FLEX(9)_DEFINE_FLEX(9)DEFINE_RAW_FLEX(9)DEFINE_FLEX(9)STACK_FLEX_ARRAY_SIZE(9)typeof_flex_counter(9)overflows_flex_counter_type(9)__set_flex_counter(9)
and that's the page!! π§ from ./include/linux, dated October 2026, signed off with all the love β wrapping_add(9) out. πβ slay responsibly.
π¦ 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