vendredi 23 octobre 2020

undefined reference error for 64bit Unsigned int to float conversion

This line in get_float64() gives error as "undefined reference to `__aeabi_ul2d'" I dont see this kind issue coming for the similar get_float32().

What could be issue here for get_float64() function..? fvalue = static_cast(value); //Showing up error while compiling for GCC..

I dont want to use reinterpret_casting here which throws up the error for -Wstrict-aliasing.

float get_float32()
{
    float fvalue(0.0f);
    uInt32 value = retrieve_uInt32();//Return 32bit Unsigned int value
    fvalue = static_cast<Float32>(value);
    return fvalue;
}

double get_float64()
{
    double fvalue = static_cast<double>(0.0f);
    uInt64 value = retrieve_uInt64(); //Return 64bit Unsigned int value
    fvalue = static_cast<double>(value);  //Showing up error while compiling for GCC..undefined reference to `__aeabi_ul2d
    return fvalue;
}

Using below code give warning with -)2 option - warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] fvalue = reinterpret_cast<Float64>(&value);

Aucun commentaire:

Enregistrer un commentaire