This is earith.c in view mode; [Download] [Up]
Changes file for /usr/local/src/kcl/c/earith.c
Created on Thu Feb 1 07:05:35 1990
Usage \n@s[Original text\n@s|Replacement Text\n@s]
See the file rascal.ics.utexas.edu:/usr2/ftp/merge.c
for a program to merge change files. Anything not between
"\n@s[" and "\n@s]" is a simply a comment.
This file was constructed using emacs and merge.el
Enhancements Copyright (c) W. Schelter All rights reserved.
by (Bill Schelter) wfs@carl.ma.utexas.edu
****Change:(orig (34 34 a))
@s[*/
#include "include.h"
@s|*/
#include "include.h"
#ifdef I386
/* by W. Schelter and M. Ballantyne */
/* debug print
#include <stdio.h>
extended_mul(a,b,r,c,d)
int a,b,r;
int *c;
int *d;
{extended_mul1(a,b,r,c,d);
printf("Multiply (%d, %d, %d) --> (%d , %d) for %d \n",a,b,r,*c,*d,a*b+r);
fflush(stdout);
}
*/
extended_mul(a,b,r,c,d)
int a,b,r;
int *c;
int *d;
{ asm("pushl %ecx");
asm(" movl 8(%ebp),%eax");
asm(" mull 12(%ebp)");
asm(" addl 16(%ebp),%eax");
asm(" adcl $0,%edx");
asm(" shll $1,%edx");
asm(" btrl $31,%eax");
asm(" adcl $0,%edx");
asm(" movl 20(%ebp),%ecx");
asm(" movl %edx, (%ecx)");
asm(" movl 24(%ebp), %ecx");
asm(" movl %eax, (%ecx)");
asm("popl %ecx");
}
extended_div(d, h, l, qp, rp)
int d, h, l;
int *qp, *rp;
{
asm( "pushl %ebx");
asm( "movl 12(%ebp),%edx");
asm( "movl 16(%ebp),%eax");
asm( "btl $0,%edx");
asm( "jae .WFS");
asm( "btsl $31,%eax");
asm(".WFS:");
asm( "shrl $1,%edx");
asm( "idivl 8(%ebp)");
asm( "movl 20(%ebp),%ebx");
asm( "movl %eax,(%ebx)");
asm( "movl 24(%ebp),%ebx");
asm( "movl %edx,(%ebx)");
asm( "popl %ebx");
}
#endif
@s]
****Change:(orig (141 141 a))
@s[ asm(" movl a6@(24),a0");
asm(" movl d0,a0@");
@s| asm(" movl a6@(24),a0");
asm(" movl d0,a0@");
asm(" movl a7@+,d2");
@s]
****Change:(orig (464 464 a))
@s[ asm("move.l d1,(a0)");
}
@s| asm("move.l d1,(a0)");
}
#endif
#ifdef CONVEX
extended_mul(d, q, r, hp, lp)
int d, q, r;
int *hp, *lp;
{
long long int ld, lq, lr, z;
int zh, zl;
ld = d;
lq = q;
lr = r;
z = ld*lq+lr;
zl = (z & 0x000000007fffffffLL);
zh = (z >> 31LL);
*hp = zh;
*lp = zl;
}
extended_div(d, h, l, qp, rp)
int d, h, l;
int *qp, *rp;
{
long long int lh, ld, ll;
ld = d;
lh = h;
ll = l;
lh = (lh << 31LL);
lh = (lh | ll);
*qp = (lh/ld);
*rp = (lh%ld);
}
#endif
#ifdef hp9000s300
extended_mul(d, q, r, hp, lp)
int d, q, r;
int *hp, *lp;
{
asm(" mov.l %d2,-(%a7)");
asm(" clr.l %d2");
asm(" mov.l (8,%fp),%d0");
asm(" mulu.l (12,%fp),%d1:%d0");
asm(" add.l (16,%fp),%d0");
asm(" addx.l %d2,%d1");
asm(" lsl.l &1,%d0");
asm(" roxl.l &1,%d1");
asm(" lsr.l &1,%d0");
asm(" mov.l (20,%fp),%a0");
asm(" mov.l %d1,(%a0)");
asm(" mov.l (24,%fp),%a0");
asm(" mov.l %d0,(%a0)");
asm(" mov.l (%a7)+,%d2");
}
extended_div(d, h, l, qp, rp)
int d, h, l;
int *qp, *rp;
{
asm(" movm.l (12,%fp),&0x303");
asm(" lsl.l &1,%d1");
asm(" lsr.l &1,%d0");
asm(" roxr.l &1,%d1");
asm(" divu.l (8,%fp),%d0:%d1");
asm(" mov.l %d0,(%a1)");
asm(" mov.l %d1,(%a0)");
}
#endif
#ifdef CMAC
#include "cmac.c"
@s]
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.