Commit 888515bf authored by Matthias Braun's avatar Matthias Braun
Browse files

create new_tarval_from_long_double function and change argument of...

create new_tarval_from_long_double function and change argument of new_tarval_from_double to double - so bindings can get away with C89 types only

[r28167]
parent d0e0079b
......@@ -203,7 +203,12 @@ FIRM_API int tarval_is_long(ir_tarval *tv);
* new_tarval_from_str()
* new_tarval_from_long()
*/
FIRM_API ir_tarval *new_tarval_from_double(long double d, ir_mode *mode);
FIRM_API ir_tarval *new_tarval_from_double(double d, ir_mode *mode);
/**
* same as new_tarval_from_double(), but with a long double argument
*/
FIRM_API ir_tarval *new_tarval_from_long_double(long double d, ir_mode *mode);
/**
* This returns a double with the value represented value, or
......@@ -214,7 +219,12 @@ FIRM_API ir_tarval *new_tarval_from_double(long double d, ir_mode *mode);
*
* @param tv the tarval
*/
FIRM_API long double get_tarval_double(ir_tarval *tv);
FIRM_API double get_tarval_double(ir_tarval *tv);
/**
* same as get_tarval_double but returns a long double value
*/
FIRM_API long double get_tarval_long_double(ir_tarval *tv);
/**
* This validates if tarval_to_double() will return a satisfying
......
......@@ -480,7 +480,7 @@ long get_tarval_long(ir_tarval* tv)
return sc_val_to_long(tv->value);
}
ir_tarval *new_tarval_from_double(long double d, ir_mode *mode)
ir_tarval *new_tarval_from_long_double(long double d, ir_mode *mode)
{
const ieee_descriptor_t *desc;
......@@ -490,6 +490,11 @@ ir_tarval *new_tarval_from_double(long double d, ir_mode *mode)
return get_tarval(fc_get_buffer(), fc_get_buffer_length(), mode);
}
ir_tarval *new_tarval_from_double(double d, ir_mode *mode)
{
return new_tarval_from_long_double(d, mode);
}
/* returns non-zero if can be converted to double */
int tarval_is_double(ir_tarval *tv)
{
......@@ -498,13 +503,18 @@ int tarval_is_double(ir_tarval *tv)
return (get_mode_sort(tv->mode) == irms_float_number);
}
long double get_tarval_double(ir_tarval *tv)
long double get_tarval_long_double(ir_tarval *tv)
{
assert(tarval_is_double(tv));
return fc_val_to_ieee754((const fp_value*) tv->value);
}
double get_tarval_double(ir_tarval *tv)
{
return get_tarval_long_double(tv);
}
/*
* Access routines for tarval fields ========================================
......
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