rtapi_div_u64(3rtapi)
β¨ rtapi_div_u64 β¨
okay bestie, welcome to the rtapi manual, section 3 π this one's called rtapi_div_u64 and it's literally just... unsigned division of a 64-bit number by a 32-bit number. that's it. that's the whole vibe. π
πΈ NAME πΈ
rtapi_div_u64 β unsigned division of a 64-bit number by a 32-bit number
π¦ SYNTAX π¦
no cap, there are four flavors and you get to pick your fighter:
__u64 rtapi_div_u64_rem(__u64 dividend, __u32 divisor, __u32 *remainder)
__u64 rtapi_div_u64(__u64 dividend, __u32 divisor)
__s64 rtapi_div_s64(__s64 dividend, __s32 divisor)
__s64 rtapi_div_s64_rem(__s64 dividend, __s32 divisor, __s32 *remainder)
π ARGUMENTS π
dividendβ the value to be divided. the main character of this operation, fr fr.divisorβ the value to divide by. the one doing the dividing. iconic behavior honestly.remainderβ pointer to the location to store the remainder. π«Ά this may not be a NULL pointer β like, do not. if you don't actually want the remainder, just callrtapi_div_u64orrtapi_div_s64instead and save yourself the trouble, bestie.
π DESCRIPTION π
perform integer division (and optionally compute the remainder) with a 64-bit dividend and 32-bit divisor. that's the tea. π it's giving "math but make it realtime."
β RETURN VALUE β
the result of integer division of dividend / divisor. π« and in the versions that take the remainder argument, the remainder gets stored in the pointed-to location. so you get two-for-one, lowkey a steal.
π NOTES π
if the result of the division does not fit in the return type, the result is undefined. π that's not a vibe check you want to fail, so be careful.
this function exists because in kernel space the use of the division operator on a 64-bit type can lead to an undefined symbol such as __umoddi3 when the module is loaded. π so yeah, this whole thing is basically a workaround so your module doesn't explode on load. iykyk.
π§ REALTIME CONSIDERATIONS π§
- may be called from init/cleanup code and from within realtime tasks. β¨
- available in non-realtime components. π«Ά
and that's the whole page, bestie!! πΈ this was the LinuxCNC Documentation version, dated 2006-10-12, for rtapi_div_u64(3rtapi). slay, go divide something. ππ
π¦ where this page comes from
- debian trixie: linuxcnc-uspace-dev 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace-dev 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- Copyright (C) 2013 Jeff Epler <jepler@unpythonic.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms