Commit 226176ca authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Fix generating bit representation of INF modes with explicit one, i.e. x87 long double.

[r24637]
parent c2d8fb74
......@@ -1329,7 +1329,10 @@ fp_value *fc_get_qnan(const ieee_descriptor_t *desc, fp_value *result) {
return result;
}
fp_value *fc_get_plusinf(const ieee_descriptor_t *desc, fp_value *result) {
fp_value *fc_get_plusinf(const ieee_descriptor_t *desc, fp_value *result)
{
char *mant;
if (result == NULL) result = calc_buffer;
result->desc.exponent_size = desc->exponent_size;
......@@ -1341,7 +1344,11 @@ fp_value *fc_get_plusinf(const ieee_descriptor_t *desc, fp_value *result) {
sc_val_from_ulong((1 << desc->exponent_size) - 1, _exp(result));
sc_val_from_ulong(0, _mant(result));
mant = _mant(result);
sc_val_from_ulong(0, mant);
if (desc->explicit_one) {
sc_set_bit_at(mant, result->desc.mantissa_size + ROUNDING_BITS);
}
return result;
}
......
......@@ -1276,6 +1276,14 @@ int sc_get_bit_at(const void *value, unsigned pos) {
return 0;
}
void sc_set_bit_at(void *value, unsigned pos)
{
char *val = value;
unsigned nibble = pos >> 2;
val[nibble] = or_table[(int)val[nibble]][(int)shift_table[pos & 3]];
}
int sc_is_zero(const void *value) {
const char* val = (const char *)value;
int counter;
......
......@@ -246,6 +246,9 @@ int sc_get_precision(void);
/** Return the bit at a given position. */
int sc_get_bit_at(const void *value, unsigned pos);
/** Set the bit at the specified position. */
void sc_set_bit_at(void *value, unsigned pos);
/* Strange semantics */
int sc_had_carry(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment