|
|
1.1 ! root 1: #include "mprec.h" ! 2: #include <assert.h> ! 3: ! 4: ! 5: /* ! 6: * Mcopy sets the mint pointed to by "b" to a copy of the mint ! 7: * pointed to by "a". This is used when a scratch copy is needed. ! 8: */ ! 9: ! 10: void ! 11: mcopy(a, b) ! 12: register mint *a, *b; ! 13: { ! 14: register char *ap, *bp; ! 15: register unsigned count; ! 16: ! 17: /* throw away old value and allocate space for new one */ ! 18: mpfree(b->val); ! 19: b->val = (char *)mpalc(a->len); ! 20: b->len = a->len; ! 21: ! 22: /* copy value */ ! 23: ap = a->val; ! 24: bp = b->val; ! 25: count = a->len; ! 26: while (count-- != 0) ! 27: *bp++ = *ap++; ! 28: assert(bp == b->val + b->len); ! 29: assert(ap == a->val + a->len); ! 30: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.