1/*
2 * giantPort_PPC_Gnu.h - giant definitions, PPC/GNU version.
3 */
4
5#ifndef	_CK_NSGIANT_PORT_PPC_GNU_H_
6#define _CK_NSGIANT_PORT_PPC_GNU_H_
7
8#include "feeDebug.h"
9#include "platform.h"
10#include "giantIntegers.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/* define this true to disable this module and use generic C versions instead */
17#define PPC_GIANT_PORT_INLINE	0
18
19#if	PPC_GIANT_PORT_INLINE
20
21#include "giantPort_Generic.h"
22
23#else	// PPC_GIANT_PORT_INLINE
24
25/*
26 * Multiple-precision arithmetic routines/macros implemented in
27 * giantPort_PPC_Gnu.s
28 */
29
30/*
31 * Add two digits, return sum. Carry bit returned as an out parameter.
32 */
33extern giantDigit giantAddDigits(
34	giantDigit dig1,
35	giantDigit dig2,
36	giantDigit *carry);			/* RETURNED, 0 or 1 */
37
38/*
39 * Add a single digit value to a double digit accumulator in place.
40 * Carry out of the MSD of the accumulator is not handled.
41 */
42void giantAddDouble(
43	giantDigit *accLow,			/* IN/OUT */
44	giantDigit *accHigh,			/* IN/OUT */
45	giantDigit val);
46
47
48/*
49 * Subtract a - b, return difference. Borrow bit returned as an out parameter.
50 */
51giantDigit giantSubDigits(
52	giantDigit a,
53	giantDigit b,
54	giantDigit *borrow);			/* RETURNED, 0 or 1 */
55
56
57/*
58 * Multiply two digits, return two digits.
59 */
60void giantMulDigits(
61	giantDigit	dig1,
62	giantDigit	dig2,
63 	giantDigit	*lowProduct,		/* RETURNED, low digit */
64	giantDigit	*hiProduct);		/* RETURNED, high digit */
65
66/*
67 * Multiply a vector of giantDigits, candVector, by a single giantDigit,
68 * plierDigit, adding results into prodVector. Returns m.s. digit from
69 * final multiply; only candLength digits of *prodVector will be written.
70 */
71giantDigit VectorMultiply(
72	giantDigit plierDigit,
73	giantDigit *candVector,
74	unsigned candLength,
75	giantDigit *prodVector);
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif	/* !PPC_GIANT_PORT_INLINE */
82
83#endif	/*_CK_NSGIANT_PORT_PPC_GNU_H_*/
84