1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-27 12:22:24 +00:00

Reformat all C source files with Clang-format in Google style w/ 100 col width.

This commit is contained in:
Nick Briggs
2017-05-28 18:08:18 -07:00
parent 691645d048
commit 156c3292f8
167 changed files with 40520 additions and 48069 deletions

70
src/ubf2.c Executable file → Normal file
View File

@@ -3,10 +3,6 @@ static char *id = "$Id: ubf2.c,v 1.3 1999/05/31 23:35:44 sybalsky Exp $ Copyrigh
/* ubf2.c
*/
/************************************************************************/
/* */
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
@@ -21,16 +17,13 @@ static char *id = "$Id: ubf2.c,v 1.3 1999/05/31 23:35:44 sybalsky Exp $ Copyrigh
#include "version.h"
#include <stdio.h>
#include <math.h>
#include "lispemul.h"
#include "medleyfp.h"
/************************************************************
OP_ub2 -- op 354 == UBFLOAT2
OP_ub2 -- op 354 == UBFLOAT2
354/0 ADD
354/1 SUB
354/2 ISUB
@@ -42,40 +35,49 @@ static char *id = "$Id: ubf2.c,v 1.3 1999/05/31 23:35:44 sybalsky Exp $ Copyrigh
354/8 REM
354/9 AREF
***********************************************************/
LispPTR N_OP_ubfloat2(int a2, int a1, int alpha)
{
REGISTER float arg1, arg2;
float ans;
int ret;
LispPTR N_OP_ubfloat2(int a2, int a1, int alpha) {
REGISTER float arg1, arg2;
float ans;
int ret;
/* Unboxed floating point args (a1, a2) look like float, but */
/* can't be declared as such because all float args get passed */
/* as double. (That can be avoided in ansi C.) Instead, they */
/* are declared int and accessed as float through cast pointers. */
/* The return value is handled similarly. */
/* Unboxed floating point args (a1, a2) look like float, but */
/* can't be declared as such because all float args get passed */
/* as double. (That can be avoided in ansi C.) Instead, they */
/* are declared int and accessed as float through cast pointers. */
/* The return value is handled similarly. */
arg1 = *(float *)&a1;
arg1 = *(float *)&a1;
arg2 = *(float *)&a2;
FPCLEAR;
switch (alpha) {
case 0: /* add */ ans = arg1 + arg2; break;
case 1: /* sub */ ans = arg2 - arg1; break;
case 0: /* add */ ans = arg1 + arg2; break;
case 1: /* sub */ ans = arg2 - arg1; break;
case 2: /* isub */ ans = arg1 - arg2; break;
case 3: /* mul */ ans = arg1 * arg2; break;
case 4: /* div */ ans = arg2 / arg1; break;
case 5: /* gt */ if (arg2 > arg1) return(ATOM_T); else return(NIL_PTR);
case 6: /* max */ if (arg2 > arg1) return(a2); else return(a1);
case 7: /* min */ if (arg2 > arg1) return(a1); else return(a2);
case 8: /* rem */ ans = fmod(arg2,arg1); break;
case 3: /* mul */ ans = arg1 * arg2; break;
case 4: /* div */ ans = arg2 / arg1; break;
case 5: /* gt */
if (arg2 > arg1)
return (ATOM_T);
else
return (NIL_PTR);
case 6: /* max */
if (arg2 > arg1)
return (a2);
else
return (a1);
case 7: /* min */
if (arg2 > arg1)
return (a1);
else
return (a2);
case 8: /* rem */ ans = fmod(arg2, arg1); break;
default: ERROR_EXIT(a1);
}/* end switch */
} /* end switch */
ret = *(int *)&ans; /* Convert it back to int for 32 bit storage */
ret = *(int *)&ans; /* Convert it back to int for 32 bit storage */
if (FPTEST(ans)) ERROR_EXIT(a1);
return(ret);
return (ret);
} /* end N_OP_ub2() */
}/* end N_OP_ub2() */
/* end module */
/* end module */