|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 377 (0x179) Types: TextFile Notes: UNIX file Names: »spow.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦f4b8d8c84⟧ UNIX Filesystem └─ ⟦this⟧ »libmp/spow.c«
#include "mprec.h" /* * Spow sets "b" to "a" raised to the "n" power. Note that * a = b is acceptable. */ void spow(a, n, b) register mint *a, *b; register unsigned n; { mint ac; minit(&ac); mcopy(a, &ac); mcopy(mone, b); if (n != 0) { for (; n != 1; n >>= 1, mult(&ac, &ac, &ac)) if (n % 2 != 0) mult(&ac, b, b); mult(&ac, b, b); } mpfree(ac.val); }