/* * The semantics of __div64_32() are: * * uint32_t __div64_32(uint64_t *n, uint32_t base) * { * uint32_t remainder = *n % base; * *n = *n / base; * return remainder; * } * * In other words, a 64-bit dividend with a 32-bit divisor producing * a 64-bit result and a 32-bit remainder. To accomplish this optimally * we override the generic version in lib/div64.c to call our __do_div64 * assembly implementation with completely non standard calling convention * for arguments and results (beware).
*/ staticinline uint32_t __div64_32(uint64_t *n, uint32_t base)
{ registerunsignedint __base asm("r4") = base; registerunsignedlonglong __n asm("r0") = *n; registerunsignedlonglong __res asm("r2"); unsignedint __rem; asm( __asmeq("%0", "r0")
__asmeq("%1", "r2")
__asmeq("%2", "r4") "bl __do_div64"
: "+r" (__n), "=r" (__res)
: "r" (__base)
: "ip", "lr", "cc");
__rem = __n >> 32;
*n = __res; return __rem;
} #define __div64_32 __div64_32
#if !defined(CONFIG_AEABI)
/* * In OABI configurations, some uses of the do_div function * cause gcc to run out of registers. To work around that, * we can force the use of the out-of-line version for * configurations that build a OABI kernel.
*/ #define do_div(n, base) __div64_32(&(n), base)
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.25Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.