summaryrefslogtreecommitdiff
path: root/float.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-10 14:58:45 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-10 14:58:45 -0700
commit6867acc18ee541e361a5fa1e5a1bac3a478a3856 (patch)
treeb13b49a2e8227469c3eb7cb983e4b2bb27868466 /float.c
parentbe1b83d24aee03d29913957fdba40cf7a268e660 (diff)
downloadnasm-6867acc18ee541e361a5fa1e5a1bac3a478a3856.tar.gz
Use the compiler-provided booleans if available, otherwise emulate
Both C and C++ have "bool", "true" and "false" in lower case; C requires <stdbool.h> for this, in C++ it is an inherent type built into the compiler. Use those instead of the old macros; emulate with a simple typedef enum if unavailable.
Diffstat (limited to 'float.c')
-rw-r--r--float.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/float.c b/float.c
index c6126890..7d7b7813 100644
--- a/float.c
+++ b/float.c
@@ -18,9 +18,6 @@
#include "nasm.h"
-#define TRUE 1
-#define FALSE 0
-
#define MANT_WORDS 10 /* 112 bits + 48 for accuracy == 160 */
#define MANT_DIGITS 49 /* 50 digits don't fit in 160 bits */
@@ -90,7 +87,7 @@ static void ieee_flconvert_hex(char *string, uint16_t *mant,
while ((c = *string++) != '\0') {
if (c == '.') {
if (!seendot)
- seendot = TRUE;
+ seendot = true;
else {
error(ERR_NONFATAL,
"too many periods in floating-point constant");
@@ -163,11 +160,11 @@ static void ieee_flconvert(char *string, uint16_t *mant,
p = digits;
tenpwr = 0;
- started = seendot = FALSE;
+ started = seendot = false;
while (*string && *string != 'E' && *string != 'e') {
if (*string == '.') {
if (!seendot)
- seendot = TRUE;
+ seendot = true;
else {
error(ERR_NONFATAL,
"too many periods in floating-point constant");
@@ -178,7 +175,7 @@ static void ieee_flconvert(char *string, uint16_t *mant,
if (seendot)
tenpwr--;
} else {
- started = TRUE;
+ started = true;
if (p < digits + sizeof(digits))
*p++ = *string - '0';
if (!seendot)
@@ -210,7 +207,7 @@ static void ieee_flconvert(char *string, uint16_t *mant,
*m = 0;
m = mant;
q = digits;
- started = FALSE;
+ started = false;
twopwr = 0;
while (m < mant + MANT_WORDS) {
uint16_t carry = 0;
@@ -229,7 +226,7 @@ static void ieee_flconvert(char *string, uint16_t *mant,
*r = i;
}
if (carry)
- *m |= bit, started = TRUE;
+ *m |= bit, started = true;
if (started) {
if (bit == 1)
bit = 0x8000, m++;