summaryrefslogtreecommitdiff
path: root/emfloat.h
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-11 23:00:38 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-11 23:00:38 +0000
commit5a7f0d2e7b4265153ccc70051bdae8b851617ede (patch)
treeb29e974f32a1ddba669359100bb6748c72cbfd1e /emfloat.h
parentbef5cb4c61e44ee8784f233eb2ec230c776dbda6 (diff)
Remove stupid datatypes. Begin code cleanup
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@5 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
Diffstat (limited to 'emfloat.h')
-rw-r--r--emfloat.h50
1 files changed, 19 insertions, 31 deletions
diff --git a/emfloat.h b/emfloat.h
index 7699c1e..2761ae5 100644
--- a/emfloat.h
+++ b/emfloat.h
@@ -26,19 +26,7 @@
*/
#include <stdio.h>
-
-/*
-** DEFINES
-*/
-#define u8 unsigned char
-#define u16 unsigned short
-#ifdef LONG64
-#define u32 unsigned int
-#else
-#define u32 unsigned long
-#endif
-#define uchar unsigned char
-#define ulong unsigned long
+#include <stdint.h>
#define MAX_EXP 32767L
#define MIN_EXP (-32767L)
@@ -97,44 +85,44 @@
typedef struct
{
- u8 type; /* Indicates, NORMAL, SUBNORMAL, etc. */
- u8 sign; /* Mantissa sign */
+ uint8_t type; /* Indicates, NORMAL, SUBNORMAL, etc. */
+ uint8_t sign; /* Mantissa sign */
short exp; /* Signed exponent...no bias */
- u16 mantissa[INTERNAL_FPF_PRECISION];
+ uint16_t mantissa[INTERNAL_FPF_PRECISION];
} InternalFPF;
/*
** PROTOTYPES
*/
void SetupCPUEmFloatArrays(InternalFPF *abase,
- InternalFPF *bbase, InternalFPF *cbase, ulong arraysize);
-ulong DoEmFloatIteration(InternalFPF *abase,
+ InternalFPF *bbase, InternalFPF *cbase, unsigned long arraysize);
+unsigned long DoEmFloatIteration(InternalFPF *abase,
InternalFPF *bbase, InternalFPF *cbase,
- ulong arraysize, ulong loops);
+ unsigned long arraysize, unsigned long loops);
static void SetInternalFPFZero(InternalFPF *dest,
- uchar sign);
+ unsigned char sign);
static void SetInternalFPFInfinity(InternalFPF *dest,
- uchar sign);
+ unsigned char sign);
static void SetInternalFPFNaN(InternalFPF *dest);
-static int IsMantissaZero(u16 *mant);
-static void Add16Bits(u16 *carry,u16 *a,u16 b,u16 c);
-static void Sub16Bits(u16 *borrow,u16 *a,u16 b,u16 c);
-static void ShiftMantLeft1(u16 *carry,u16 *mantissa);
-static void ShiftMantRight1(u16 *carry,u16 *mantissa);
+static int IsMantissaZero(uint16_t *mant);
+static void Add16Bits(uint16_t *carry,uint16_t *a,uint16_t b,uint16_t c);
+static void Sub16Bits(uint16_t *borrow,uint16_t *a,uint16_t b,uint16_t c);
+static void ShiftMantLeft1(uint16_t *carry,uint16_t *mantissa);
+static void ShiftMantRight1(uint16_t *carry,uint16_t *mantissa);
static void StickyShiftRightMant(InternalFPF *ptr,int amount);
static void normalize(InternalFPF *ptr);
static void denormalize(InternalFPF *ptr,int minimum_exponent);
void RoundInternalFPF(InternalFPF *ptr);
static void choose_nan(InternalFPF *x,InternalFPF *y,InternalFPF *z,
int intel_flag);
-static void AddSubInternalFPF(uchar operation,InternalFPF *x,
+static void AddSubInternalFPF(unsigned char operation,InternalFPF *x,
InternalFPF *y,InternalFPF *z);
static void MultiplyInternalFPF(InternalFPF *x,InternalFPF *y,
InternalFPF *z);
static void DivideInternalFPF(InternalFPF *x,InternalFPF *y,
InternalFPF *z);
/* static void LongToInternalFPF(long mylong, */
-static void Int32ToInternalFPF(int32 mylong,
+static void Int32ToInternalFPF(int32_t mylong,
InternalFPF *dest);
#ifdef DEBUG
static int InternalFPFToString(char *dest,
@@ -144,7 +132,7 @@ static int InternalFPFToString(char *dest,
/*
** EXTERNALS
*/
-extern ulong StartStopwatch();
-extern ulong StopStopwatch(ulong elapsed);
+extern unsigned long StartStopwatch();
+extern unsigned long StopStopwatch(unsigned long elapsed);
/* extern long randwc(long num); */
-extern int32 randwc(int32 num);
+extern int32_t randwc(int32_t num);