Skip to content

Commit

Permalink
Font: Explicitly use uint32_t to calculate bitmask
Browse files Browse the repository at this point in the history
Calculating the bitmask for the glyph id, explicitly use uint32_t which
avoids signed/unsigned comparisons that might occur depending on the
integer sizes of the target ABI when implicit conversions are applied.

Relates:	#5
  • Loading branch information
Zirias committed Aug 9, 2024
1 parent a2c7e1c commit fe69c78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bin/xmoji/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ static Font *createFromFile(const char *file, int index, char *id,
}
uint8_t glyphidbits = 1;
uint32_t glyphidmask = 1;
while ((face->num_glyphs & glyphidmask) != face->num_glyphs)
while (((uint32_t)face->num_glyphs & glyphidmask)
!= (uint32_t)face->num_glyphs)
{
++glyphidbits;
glyphidmask <<= 1;
Expand Down

0 comments on commit fe69c78

Please sign in to comment.