Rev | Line | |
---|
[9] | 1 | /* $Header: /cvsup/minix/src/lib/ack/libp/mdi.c,v 1.1 2005/10/10 15:27:47 beng Exp $ */
|
---|
| 2 | /*
|
---|
| 3 | * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
---|
| 4 | *
|
---|
| 5 | * This product is part of the Amsterdam Compiler Kit.
|
---|
| 6 | *
|
---|
| 7 | * Permission to use, sell, duplicate or disclose this software must be
|
---|
| 8 | * obtained in writing. Requests for such permissions may be sent to
|
---|
| 9 | *
|
---|
| 10 | * Dr. Andrew S. Tanenbaum
|
---|
| 11 | * Wiskundig Seminarium
|
---|
| 12 | * Vrije Universiteit
|
---|
| 13 | * Postbox 7161
|
---|
| 14 | * 1007 MC Amsterdam
|
---|
| 15 | * The Netherlands
|
---|
| 16 | *
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | /* Author: J.W. Stevenson */
|
---|
| 20 |
|
---|
| 21 | #include <pc_err.h>
|
---|
| 22 |
|
---|
| 23 | extern _trp();
|
---|
| 24 |
|
---|
| 25 | int _mdi(j,i) int j,i; {
|
---|
| 26 |
|
---|
| 27 | if (j <= 0)
|
---|
| 28 | _trp(EMOD);
|
---|
| 29 | i = i % j;
|
---|
| 30 | if (i < 0)
|
---|
| 31 | i += j;
|
---|
| 32 | return(i);
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | long _mdil(j,i) long j,i; {
|
---|
| 36 |
|
---|
| 37 | if (j <= 0)
|
---|
| 38 | _trp(EMOD);
|
---|
| 39 | i = i % j;
|
---|
| 40 | if (i < 0)
|
---|
| 41 | i += j;
|
---|
| 42 | return(i);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | int _dvi(j, i) unsigned int j,i; {
|
---|
| 46 | int neg = 0;
|
---|
| 47 |
|
---|
| 48 | if ((int)j < 0) {
|
---|
| 49 | j = -(int)j; neg = 1;
|
---|
| 50 | }
|
---|
| 51 | if ((int)i < 0) {
|
---|
| 52 | i = -(int)i; neg = !neg;
|
---|
| 53 | }
|
---|
| 54 | i = i / j;
|
---|
| 55 | if (neg) return -(int)i;
|
---|
| 56 | return i;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | long _dvil(j, i) unsigned long j,i; {
|
---|
| 60 | int neg = 0;
|
---|
| 61 |
|
---|
| 62 | if ((long)j < 0) {
|
---|
| 63 | j = -(long)j; neg = 1;
|
---|
| 64 | }
|
---|
| 65 | if ((long)i < 0) {
|
---|
| 66 | i = -(long)i; neg = !neg;
|
---|
| 67 | }
|
---|
| 68 | i = i / j;
|
---|
| 69 | if (neg) return -(long)i;
|
---|
| 70 | return i;
|
---|
| 71 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.