/* * The above table can be verified with the following shell script: * * #!/bin/sh * sed -ne 's/^{ \+\(.*\), \+\(.*\), \+\(.*\), \+\(.*\) },$/\1 \2 \3 \4/p' \ * lib/math/test_mul_u64_u64_div_u64.c | * while read a b c r; do * expected=$( printf "obase=16; ibase=16; %X * %X / %X\n" $a $b $c | bc ) * given=$( printf "%X\n" $r ) * if [ "$expected" = "$given" ]; then * echo "$a * $b / $c = $r OK" * else * echo "$a * $b / $c = $r is wrong" >&2 * echo "should be equivalent to 0x$expected" >&2 * exit 1 * fi * done
*/
staticint __init test_init(void)
{ int i;
pr_info("Starting mul_u64_u64_div_u64() test\n");
for (i = 0; i < ARRAY_SIZE(test_values); i++) {
u64 a = test_values[i].a;
u64 b = test_values[i].b;
u64 c = test_values[i].c;
u64 expected_result = test_values[i].result;
u64 result = mul_u64_u64_div_u64(a, b, c);
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.