summaryrefslogtreecommitdiff
path: root/float.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-04-30 20:53:55 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-04-30 20:53:55 +0000
commiteba20a73f2b3396f617747e789e35a679eb09606 (patch)
tree2a1b5e2652e39022a1d6ff7a36a630041edad1b6 /float.c
parent87bc61964cf5d2cc2e322883d6f927a43fb53af3 (diff)
downloadnasm-eba20a73f2b3396f617747e789e35a679eb09606.tar.gz
NASM 0.98p3nasm-0.98p3
Diffstat (limited to 'float.c')
-rw-r--r--float.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/float.c b/float.c
index 1f66ca61..545ae773 100644
--- a/float.c
+++ b/float.c
@@ -25,9 +25,10 @@
* => we only have to worry about _one_ bit shift to the left
*/
-static int multiply(unsigned short *to, unsigned short *from) {
+static int multiply(unsigned short *to, unsigned short *from)
+{
unsigned long temp[MANT_WORDS*2];
- int i, j;
+ int i, j;
for (i=0; i<MANT_WORDS*2; i++)
temp[i] = 0;
@@ -56,11 +57,14 @@ static int multiply(unsigned short *to, unsigned short *from) {
}
static void flconvert(char *string, unsigned short *mant, long *exponent,
- efunc error) {
- char digits[MANT_DIGITS], *p, *q, *r;
- unsigned short mult[MANT_WORDS], *m, bit;
- long tenpwr, twopwr;
- int extratwos, started, seendot;
+ efunc error)
+{
+ char digits[MANT_DIGITS];
+ char *p, *q, *r;
+ unsigned short mult[MANT_WORDS], bit;
+ unsigned short * m;
+ long tenpwr, twopwr;
+ int extratwos, started, seendot;
p = digits;
tenpwr = 0;
@@ -179,9 +183,10 @@ static void flconvert(char *string, unsigned short *mant, long *exponent,
/*
* Shift a mantissa to the right by i (i < 16) bits.
*/
-static void shr(unsigned short *mant, int i) {
+static void shr(unsigned short *mant, int i)
+{
unsigned short n = 0, m;
- int j;
+ int j;
for (j=0; j<MANT_WORDS; j++) {
m = (mant[j] << (16-i)) & 0xFFFF;
@@ -193,7 +198,8 @@ static void shr(unsigned short *mant, int i) {
/*
* Round a mantissa off after i words.
*/
-static int round(unsigned short *mant, int i) {
+static int round(unsigned short *mant, int i)
+{
if (mant[i] & 0x8000) {
do {
++mant[--i];
@@ -207,7 +213,8 @@ static int round(unsigned short *mant, int i) {
#define put(a,b) ( (*(a)=(b)), ((a)[1]=(b)>>8) )
static int to_double(char *str, long sign, unsigned char *result,
- efunc error) {
+ efunc error)
+{
unsigned short mant[MANT_WORDS];
long exponent;
@@ -267,7 +274,8 @@ static int to_double(char *str, long sign, unsigned char *result,
}
static int to_float(char *str, long sign, unsigned char *result,
- efunc error) {
+ efunc error)
+{
unsigned short mant[MANT_WORDS];
long exponent;
@@ -320,7 +328,8 @@ static int to_float(char *str, long sign, unsigned char *result,
}
static int to_ldoub(char *str, long sign, unsigned char *result,
- efunc error) {
+ efunc error)
+{
unsigned short mant[MANT_WORDS];
long exponent;
@@ -379,7 +388,8 @@ static int to_ldoub(char *str, long sign, unsigned char *result,
}
int float_const (char *number, long sign, unsigned char *result, int bytes,
- efunc error) {
+ efunc error)
+{
if (bytes == 4)
return to_float (number, sign, result, error);
else if (bytes == 8)