Last change
on this file since 66b48e7 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
1.4 KB
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | addfpu.c -- FPU time functions
|
---|
4 | Version 1 -- 1987-09-14 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 |
|
---|
10 | #define MAXSEGT 32767
|
---|
11 |
|
---|
12 | extern unsigned tofpu(), fromfpu();
|
---|
13 |
|
---|
14 | /* |
---|
15 |
|
---|
16 | */
|
---|
17 |
|
---|
18 | /*
|
---|
19 | =============================================================================
|
---|
20 | addfpu() -- find next higher FPU time 'k' milliseconds greater than 't'
|
---|
21 | =============================================================================
|
---|
22 | */
|
---|
23 |
|
---|
24 | unsigned
|
---|
25 | addfpu(t, k)
|
---|
26 | unsigned t;
|
---|
27 | short k;
|
---|
28 | {
|
---|
29 | register short x, z;
|
---|
30 | register unsigned y;
|
---|
31 |
|
---|
32 | x = fromfpu(t);
|
---|
33 |
|
---|
34 | if (x EQ MAXSEGT)
|
---|
35 | return(t);
|
---|
36 |
|
---|
37 | y = t;
|
---|
38 | z = x + k;
|
---|
39 |
|
---|
40 | if (z GE MAXSEGT)
|
---|
41 | return(tofpu(MAXSEGT));
|
---|
42 |
|
---|
43 | while ((y EQ t) OR (z > x))
|
---|
44 | y = tofpu(++x);
|
---|
45 |
|
---|
46 | return(y);
|
---|
47 | }
|
---|
48 |
|
---|
49 | /* |
---|
50 |
|
---|
51 | */
|
---|
52 |
|
---|
53 | /*
|
---|
54 | =============================================================================
|
---|
55 | subfpu() -- find next lower FPU time 'k' milliseconds less than 't'
|
---|
56 | =============================================================================
|
---|
57 | */
|
---|
58 |
|
---|
59 | unsigned
|
---|
60 | subfpu(t, k)
|
---|
61 | unsigned t;
|
---|
62 | short k;
|
---|
63 | {
|
---|
64 | register short x, z;
|
---|
65 | register unsigned y;
|
---|
66 |
|
---|
67 | x = fromfpu(t);
|
---|
68 |
|
---|
69 | if (x EQ 1)
|
---|
70 | return(t);
|
---|
71 |
|
---|
72 | y = t;
|
---|
73 | z = x - k;
|
---|
74 |
|
---|
75 | if (z LE 1)
|
---|
76 | return(tofpu(1));
|
---|
77 |
|
---|
78 | while ((y EQ t) OR (z < x))
|
---|
79 | y = tofpu(--x);
|
---|
80 |
|
---|
81 | return(y);
|
---|
82 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.