source: buchla-68k/ram/addfpu.c@ 526a993

Last change on this file since 526a993 was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Zero redundant declarations.

  • Property mode set to 100644
File size: 1.3 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 "ram.h"
9
10#define MAXSEGT 32767
11
12/*
13
14*/
15
16/*
17 =============================================================================
18 addfpu() -- find next higher FPU time 'k' milliseconds greater than 't'
19 =============================================================================
20*/
21
22uint16_t addfpu(uint16_t t, int16_t k)
23{
24 register int16_t x, z;
25 register uint16_t y;
26
27 x = fromfpu(t);
28
29 if (x EQ MAXSEGT)
30 return(t);
31
32 y = t;
33 z = x + k;
34
35 if (z GE MAXSEGT)
36 return(tofpu(MAXSEGT));
37
38 while ((y EQ t) OR (z > x))
39 y = tofpu(++x);
40
41 return(y);
42}
43
44/*
45
46*/
47
48/*
49 =============================================================================
50 subfpu() -- find next lower FPU time 'k' milliseconds less than 't'
51 =============================================================================
52*/
53
54uint16_t subfpu(uint16_t t, int16_t k)
55{
56 register int16_t x, z;
57 register uint16_t y;
58
59 x = fromfpu(t);
60
61 if (x EQ 1)
62 return(t);
63
64 y = t;
65 z = x - k;
66
67 if (z LE 1)
68 return(tofpu(1));
69
70 while ((y EQ t) OR (z < x))
71 y = tofpu(--x);
72
73 return(y);
74}
75
Note: See TracBrowser for help on using the repository browser.