sft_ext.c 677 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. /*
  7. SHIFT TWO EXTENDED NUMBERS INTO PROPER
  8. ALIGNMENT FOR ADDITION (exponents are equal)
  9. Numbers should not be zero on entry.
  10. */
  11. #include "FP_types.h"
  12. void
  13. sft_ext(e1,e2)
  14. EXTEND *e1,*e2;
  15. {
  16. register EXTEND *s;
  17. register int diff;
  18. diff = e1->exp - e2->exp;
  19. if (!diff)
  20. return; /* exponents are equal */
  21. if (diff < 0) { /* e2 is larger */
  22. /* shift e1 */
  23. diff = -diff;
  24. s = e1;
  25. }
  26. else /* e1 is larger */
  27. /* shift e2 */
  28. s = e2;
  29. s->exp += diff;
  30. b64_sft(&(s->mantissa), diff);
  31. }