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

Last change on this file since fa38804 was fa38804, checked in by Thomas Lopatic <thomas@…>, 4 years ago

Removed form-feed comments.

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