Skip to content
Snippets Groups Projects
Commit 3feb647f authored by Sergei Poselenov's avatar Sergei Poselenov Committed by Wolfgang Denk
Browse files

Add a do_div() wrapper macro, lldiv().


Add a do_div() wrapper, lldiv(). The new inline function doesn't modify
the dividend and returns the result of division, so it is useful
in complex expressions, i.e. "return(a/b)" -> "return(lldiv(a,b))"

Signed-off-by: default avatarSergei Poselenov <sposelenov@emcraft.com>
parent 6dadc919
No related branches found
No related tags found
No related merge requests found
......@@ -36,4 +36,14 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
__rem; \
})
/* Wrapper for do_div(). Doesn't modify dividend and returns
* the result, not reminder.
*/
static inline uint64_t lldiv(uint64_t dividend, uint32_t divisor)
{
uint64_t __res = dividend;
do_div(__res, divisor);
return(__res);
}
#endif /* _ASM_GENERIC_DIV64_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment