Commit 2fd68d96 authored by Linus Torvalds's avatar Linus Torvalds

Document non-standard do_div() calling convention, since

it does not work like a C function.

(Effectively, the first argument ends up being "passed-
by-reference" without the use of pointers)
parent 0b53593b
#ifndef __I386_DIV64 #ifndef __I386_DIV64
#define __I386_DIV64 #define __I386_DIV64
/*
* do_div() is NOT a C function. It wants to return
* two values (the quotient and the remainder), but
* since that doesn't work very well in C, what it
* does is:
*
* - modifies the 64-bit dividend _in_place_
* - returns the 32-bit remainder
*
* This ends up being the most efficient "calling
* convention" on x86.
*/
#define do_div(n,base) ({ \ #define do_div(n,base) ({ \
unsigned long __upper, __low, __high, __mod; \ unsigned long __upper, __low, __high, __mod; \
asm("":"=a" (__low), "=d" (__high):"A" (n)); \ asm("":"=a" (__low), "=d" (__high):"A" (n)); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment