Changeset 7258c6a in buchla-68k for ram/dec2fr.c
- Timestamp:
- 07/09/2017 04:45:34 PM (7 years ago)
- Branches:
- master
- Children:
- 8618599
- Parents:
- 0292fbb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ram/dec2fr.c
r0292fbb r7258c6a 12 12 #define SFACT 1000L /* scale factor */ 13 13 14 static longd2f[][10] = { /* decimal to fraction table */14 static int32_t d2f[][10] = { /* decimal to fraction table */ 15 15 16 16 {0x00000000L, 0x000019A0L, 0x00003336L, 0x00004CD0L, 0x00006668L, … … 21 21 }; 22 22 23 static longf2d[] = { /* fraction to decimal table */23 static int32_t f2d[] = { /* fraction to decimal table */ 24 24 25 25 50000L, 25000L, 12500L, 6250L, … … 42 42 */ 43 43 44 short dec2fr(char*s)44 int16_t dec2fr(int8_t *s) 45 45 { 46 register short i;46 register int16_t i; 47 47 48 48 if (s[0] EQ '1') { … … 105 105 */ 106 106 107 char *fr2dec(short v, char*s)107 int8_t *fr2dec(int16_t v, int8_t *s) 108 108 { 109 register longacc, sc;110 register short i, p;109 register int32_t acc, sc; 110 register int16_t i, p; 111 111 112 112 if (v EQ 0x7FFF) { /* +100 */ … … 140 140 sc = SFACT; 141 141 acc /= sc; 142 sprintf(s, "%03d%c", ( short)acc, p);142 sprintf(s, "%03d%c", (int16_t)acc, p); 143 143 return(s); 144 144 }
Note:
See TracChangeset
for help on using the changeset viewer.