xref: /kernel/linux/linux-5.10/arch/sh/lib/div64-generic.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/arch/sh/lib/
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Generic __div64_32 wrapper for __xdiv64_32.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#include <linux/types.h>
78c2ecf20Sopenharmony_ci#include <asm/div64.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciextern uint64_t __xdiv64_32(u64 n, u32 d);
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciuint32_t __div64_32(u64 *xp, u32 y)
128c2ecf20Sopenharmony_ci{
138c2ecf20Sopenharmony_ci	uint32_t rem;
148c2ecf20Sopenharmony_ci	uint64_t q = __xdiv64_32(*xp, y);
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci	rem = *xp - q * y;
178c2ecf20Sopenharmony_ci	*xp = q;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci	return rem;
208c2ecf20Sopenharmony_ci}
21

Indexes created Thu Nov 07 10:32:03 CST 2024