include/linux/math64.h
Source file repositories/reference/linux-study-clean/include/linux/math64.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/math64.h- Extension
.h- Size
- 11048 bytes
- Lines
- 431
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
Dependency Surface
linux/types.hlinux/math.hasm/div64.hvdso/math64.h
Detected Declarations
function div_u64_remfunction div_s64_remfunction div64_u64_remfunction div64_u64function div64_s64function div_u64_remfunction div_u64function div_s64function mul_u32_u32function add_u64_u32function mul_u64_u32_shrfunction mul_u64_u64_shrfunction mul_u64_u32_shrfunction mul_u64_u64_shrfunction mul_s64_u64_shrfunction mul_u64_u32_divfunction round_up
Annotated Snippet
#ifndef _LINUX_MATH64_H
#define _LINUX_MATH64_H
#include <linux/types.h>
#include <linux/math.h>
#include <asm/div64.h>
#include <vdso/math64.h>
#if BITS_PER_LONG == 64
#define div64_long(x, y) div64_s64((x), (y))
#define div64_ul(x, y) div64_u64((x), (y))
/**
* div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
* @dividend: unsigned 64bit dividend
* @divisor: unsigned 32bit divisor
* @remainder: pointer to unsigned 32bit remainder
*
* Return: sets ``*remainder``, then returns dividend / divisor
*
* This is commonly provided by 32bit archs to provide an optimized 64bit
* divide.
*/
static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
{
*remainder = dividend % divisor;
return dividend / divisor;
}
/**
* div_s64_rem - signed 64bit divide with 32bit divisor with remainder
* @dividend: signed 64bit dividend
* @divisor: signed 32bit divisor
* @remainder: pointer to signed 32bit remainder
*
* Return: sets ``*remainder``, then returns dividend / divisor
*/
static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
{
*remainder = dividend % divisor;
return dividend / divisor;
}
/**
* div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
* @dividend: unsigned 64bit dividend
* @divisor: unsigned 64bit divisor
* @remainder: pointer to unsigned 64bit remainder
*
* Return: sets ``*remainder``, then returns dividend / divisor
*/
static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
{
*remainder = dividend % divisor;
return dividend / divisor;
}
/**
* div64_u64 - unsigned 64bit divide with 64bit divisor
* @dividend: unsigned 64bit dividend
* @divisor: unsigned 64bit divisor
*
* Return: dividend / divisor
*/
static inline u64 div64_u64(u64 dividend, u64 divisor)
{
return dividend / divisor;
}
/**
* div64_s64 - signed 64bit divide with 64bit divisor
* @dividend: signed 64bit dividend
* @divisor: signed 64bit divisor
*
* Return: dividend / divisor
*/
static inline s64 div64_s64(s64 dividend, s64 divisor)
{
return dividend / divisor;
}
#elif BITS_PER_LONG == 32
#define div64_long(x, y) div_s64((x), (y))
#define div64_ul(x, y) div_u64((x), (y))
#ifndef div_u64_rem
static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
{
Annotation
- Immediate include surface: `linux/types.h`, `linux/math.h`, `asm/div64.h`, `vdso/math64.h`.
- Detected declarations: `function div_u64_rem`, `function div_s64_rem`, `function div64_u64_rem`, `function div64_u64`, `function div64_s64`, `function div_u64_rem`, `function div_u64`, `function div_s64`, `function mul_u32_u32`, `function add_u64_u32`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.