diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-07-03 20:16:07 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-07-03 20:16:07 -0700 |
commit | 63ebf1650c65bfb2e2dcda220fa411322d4d71bb (patch) | |
tree | cb25e1a0fafca6e82774f48f79f9111b3b7b2223 /float.c | |
parent | 45f22924ea0b8d2459d4f7d8a883ad325f196ba9 (diff) | |
download | nasm-63ebf1650c65bfb2e2dcda220fa411322d4d71bb.tar.gz nasm-63ebf1650c65bfb2e2dcda220fa411322d4d71bb.tar.bz2 nasm-63ebf1650c65bfb2e2dcda220fa411322d4d71bb.zip |
For consistency, allow 0p.. prefix for packed BCD
Allow 0p... to be used as a prefix, for analogy with base conversion.
Diffstat (limited to 'float.c')
-rw-r--r-- | float.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -638,14 +638,13 @@ enum floats { FL_SNAN }; -static int to_packed_bcd(const char *str, const char *strend, +static int to_packed_bcd(const char *str, const char *p, int s, uint8_t *result, const struct ieee_format *fmt) { int n = 0; char c; int tv = -1; - const char *p = strend-2; if (fmt != &ieee_80) { error(ERR_NONFATAL|ERR_PASS1, @@ -715,7 +714,7 @@ static int to_float(const char *str, int s, uint8_t *result, strend = strchr(str, '\0'); if (strend[-1] == 'P' || strend[-1] == 'p') - return to_packed_bcd(str, strend, s, result, fmt); + return to_packed_bcd(str, strend-2, s, result, fmt); if (str[0] == '_') { /* Special tokens */ @@ -760,6 +759,8 @@ static int to_float(const char *str, int s, uint8_t *result, case 't': case 'T': ok = ieee_flconvert(str+2, mant, &exponent); break; + case 'p': case 'P': + return to_packed_bcd(str+2, strend-1, s, result, fmt); default: /* Leading zero was just a zero? */ ok = ieee_flconvert(str, mant, &exponent); |