pull in the exec smp setting via etask.h
[AROS.git] / rom / utility / umult64.c
blob5585aaba755d0000d850ef78559b3b6e54e073a8
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Unsigned 64-bit product of two 32-bit numbers.
6 Lang: english
7 */
8 #include "intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/utility.h>
15 AROS_LH2(UQUAD, UMult64,
17 /* SYNOPSIS */
18 AROS_LHA(ULONG, arg1, D0),
19 AROS_LHA(ULONG, arg2, D1),
21 /* LOCATION */
22 struct UtilityBase *, UtilityBase, 34, Utility)
24 /* FUNCTION
25 Compute the unsigned 64-bit product of arg1 * arg2.
27 INPUTS
28 arg1, arg2 - 32 bit unsigned numbers.
30 RESULT
31 arg1 * arg2
33 NOTES
34 For m68k assembly programmers, UQUADs are returned in D0:D1 (with
35 the high 32 bits in D0.
37 This function is really only for people programming in
38 assembly on real Amigas. Most compilers will be able to do this
39 math for you inline.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 SMult32(), UMult32(), SMult64()
48 INTERNALS
49 This may or may not be handled by code in config/$(KERNEL),
50 for m68k-native it is...
52 This is essentially UMult32(), but with the code to calculate
53 the product of the high 32 bits of the multiplicands.
55 HISTORY
56 29-10-95 digulla automatically created from
57 utility_lib.fd and clib/utility_protos.h
58 18-08-96 iaint Modified UMult32().
60 *****************************************************************************/
62 AROS_LIBFUNC_INIT
64 /* If we have native support for 32 * 32 -> 64, use that. */
65 return (UQUAD)arg1 * arg2;
68 #if 0
69 /* This is partially the algoritm that is used, however for a
70 more complete version see config/m68k-native/smult64.s
72 This version has problems with:
73 - adding the partial products together
74 - setting the value of QUADs
77 UQUAD product;
78 UWORD a0, a1, b0, b1;
79 ULONG part_prod;
81 a1 = (arg1 >> 16) & 0xffff;
82 a0 = arg1 & 0xffff;
83 b1 = (arg2 >> 16) & 0xffff;
84 b0 = arg2 & 0xffff;
86 part_prod = (a0 * b1) + (a1 * b0);
88 SET_HIGH32OF64(product, (part_prod >> 16) + (a1 * b1));
89 SET_LOW32OF64(product, ((part_prod & 0xFFFF) << 16) + (a0 * b0));
91 return product;
92 #endif
94 AROS_LIBFUNC_EXIT
95 } /* UMult64 */