---
name: "rtapi_div_u64"
section: "3rtapi"
platform: "linux"
package: "linuxcnc-uspace-dev"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rtapi_div_u64"
---

# rtapi\_div\_u64(3rtapi)

unsigned division of a 64-bit number by a 32-bit number

## NAME

rtapi\_div\_u64 - unsigned division of a 64-bit number by a 32-bit number

## SYNTAX

\_\_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

- *divisor*

  The value to divide by

- *remainder*

  Pointer to the location to store the remainder.  This may not be a NULL pointer.  If the remainder is not desired, call **rtapi\_div\_u64** or **rtapi\_div\_s64**.

## DESCRIPTION

Perform integer division (and optionally compute the remainder) with a 64-bit dividend and 32-bit divisor.

## RETURN VALUE

The result of integer division of *dividend / divisor*. In versions with the *remainder* argument, the remainder is stored in the pointed-to location.

## NOTES

If the result of the division does not fit in the return type, the result is undefined.

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.

## REALTIME CONSIDERATIONS

May be called from init/cleanup code and from within realtime tasks. Available in non-realtime components.
