Changeset 7258c6a in buchla-68k for ram/dec2fr.c


Ignore:
Timestamp:
07/09/2017 04:45:34 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
8618599
Parents:
0292fbb
Message:

Use standard integer types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ram/dec2fr.c

    r0292fbb r7258c6a  
    1212#define SFACT   1000L           /* scale factor */
    1313
    14 static long d2f[][10] = {       /* decimal to fraction table */
     14static int32_t d2f[][10] = {    /* decimal to fraction table */
    1515
    1616        {0x00000000L, 0x000019A0L, 0x00003336L, 0x00004CD0L, 0x00006668L,
     
    2121};
    2222
    23 static long f2d[] = {           /* fraction to decimal table */
     23static int32_t f2d[] = {                /* fraction to decimal table */
    2424
    2525        50000L, 25000L, 12500L,  6250L,
     
    4242*/
    4343
    44 short dec2fr(char *s)
     44int16_t dec2fr(int8_t *s)
    4545{
    46         register short i;
     46        register int16_t i;
    4747
    4848        if (s[0] EQ '1') {
     
    105105*/
    106106
    107 char *fr2dec(short v, char *s)
     107int8_t *fr2dec(int16_t v, int8_t *s)
    108108{
    109         register long acc, sc;
    110         register short i, p;
     109        register int32_t acc, sc;
     110        register int16_t i, p;
    111111
    112112        if (v EQ 0x7FFF) {      /* +100 */
     
    140140        sc = SFACT;
    141141        acc /= sc;
    142         sprintf(s, "%03d%c", (short)acc, p);
     142        sprintf(s, "%03d%c", (int16_t)acc, p);
    143143        return(s);
    144144}
Note: See TracChangeset for help on using the changeset viewer.