Resolve some of clang's double-promotion warnings

This commit is contained in:
Ebrahim Byagowi 2018-04-23 19:36:53 +04:30 committed by Behdad Esfahbod
parent 24b8b9b227
commit 816b8169a9
3 changed files with 8 additions and 8 deletions

View File

@ -104,7 +104,7 @@ struct TrackData
const TrackTableEntry *trackTableEntry = nullptr;
for (unsigned int i = 0; i < sizes; ++i)
// For now we only seek for track entries with zero tracking value
if (trackTable[i].get_track_value () == 0.)
if (trackTable[i].get_track_value () == 0.f)
trackTableEntry = &trackTable[0];
// We couldn't match any, exit
@ -127,8 +127,8 @@ struct TrackData
float s0 = size_table[size_index - 1].to_float ();
float s1 = size_table[size_index].to_float ();
float t = (csspx - s0) / (s1 - s0);
return t * trackTableEntry->get_value (base, size_index) +
(1.0 - t) * trackTableEntry->get_value (base, size_index - 1);
return (float) t * trackTableEntry->get_value (base, size_index) +
((float) 1.0 - t) * trackTableEntry->get_value (base, size_index - 1);
}
protected:

View File

@ -684,8 +684,8 @@ typedef HBUINT16 UFWORD;
struct F2DOT14 : HBINT16
{
// 16384 means 1<<14
inline float to_float (void) const { return ((int32_t) v) / 16384.0; }
inline void set_float (float f) { v.set (round (f * 16384.0)); }
inline float to_float (void) const { return ((int32_t) v) / 16384.f; }
inline void set_float (float f) { v.set (round (f * 16384.f)); }
public:
DEFINE_SIZE_STATIC (2);
};
@ -694,8 +694,8 @@ struct F2DOT14 : HBINT16
struct Fixed : HBINT32
{
// 65536 means 1<<16
inline float to_float (void) const { return ((int32_t) v) / 65536.0; }
inline void set_float (float f) { v.set (round (f * 65536.0)); }
inline float to_float (void) const { return ((int32_t) v) / 65536.f; }
inline void set_float (float f) { v.set (round (f * 65536.f)); }
public:
DEFINE_SIZE_STATIC (4);
};

View File

@ -1280,7 +1280,7 @@ struct VarRegionList
{
int coord = i < coord_len ? coords[i] : 0;
float factor = axes[i].evaluate (coord);
if (factor == 0.)
if (factor == 0.f)
return 0.;
v *= factor;
}