diff options
author | Maciej W. Rozycki <macro@orcam.me.uk> | 2021-04-20 05:50:33 +0300 |
---|---|---|
committer | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 2021-04-21 14:45:36 +0300 |
commit | f2875832387a25efe7c3be3c5153f3a00e313906 (patch) | |
tree | 3cd5a3df45a063b8e8e437eaf2f4cfb17f1fad95 /include/asm-generic | |
parent | 5086ea4b0f58ba72c19553c4a657d7b2c0d8efc2 (diff) | |
download | linux-f2875832387a25efe7c3be3c5153f3a00e313906.tar.xz |
div64: Correct inline documentation for `do_div'
Correct inline documentation for `do_div', which is a function-like
macro the `n' parameter of which has the semantics of a C++ reference:
it is both read and written in the context of the caller without an
explicit dereference such as with a pointer.
In the C programming language it has no equivalent for proper functions,
in terms of which the documentation expresses the semantics of `do_div',
but substituting a pointer in documentation is misleading, and using the
C++ notation should at least raise the reader's attention and encourage
to seek explanation even if the C++ semantics is not readily understood.
While at it observe that "semantics" is an uncountable noun, so refer to
it with a singular rather than plural verb.
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/div64.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h index a3b98c86f077..cd905b44a630 100644 --- a/include/asm-generic/div64.h +++ b/include/asm-generic/div64.h @@ -8,12 +8,14 @@ * Optimization for constant divisors on 32-bit machines: * Copyright (C) 2006-2015 Nicolas Pitre * - * The semantics of do_div() are: + * The semantics of do_div() is, in C++ notation, observing that the name + * is a function-like macro and the n parameter has the semantics of a C++ + * reference: * - * uint32_t do_div(uint64_t *n, uint32_t base) + * uint32_t do_div(uint64_t &n, uint32_t base) * { - * uint32_t remainder = *n % base; - * *n = *n / base; + * uint32_t remainder = n % base; + * n = n / base; * return remainder; * } * |