remove htonl function

This commit is contained in:
lexborisov 2016-09-07 16:35:44 +04:00
parent 00c500f0e8
commit 3a6dbfba0f
4 changed files with 18 additions and 2 deletions

View File

@ -151,6 +151,8 @@ uint32_t myfont_read_u32(uint8_t** data);
uint32_t myfont_read_u32_as_net(uint8_t** data);
uint32_t myfont_htonl(uint32_t data);
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@ -365,14 +365,14 @@ float myfont_metrics_glyph_offset_y(myfont_font_t *mf, unsigned long codepoint,
int16_t myfont_table_version_major(uint32_t version)
{
version = htonl(version);
version = myfont_htonl(version);
version >>= 16;
return (int16_t)version;
}
int16_t myfont_table_version_minor(uint32_t version)
{
version = htonl(version);
version = myfont_htonl(version);
version <<= 16;
version >>= 16;
return (int16_t)version;

View File

@ -56,6 +56,18 @@ int32_t myfont_read_32(uint8_t** data)
return (int32_t)cp;
}
uint32_t myfont_htonl(uint32_t data)
{
int cp = 0;
cp = data << 24;
cp |= data << 16;
cp |= data << 8;
cp |= data;
return (uint32_t)cp;
}
uint16_t myfont_read_u16(uint8_t** data)
{
int cp = 0;

View File

@ -151,6 +151,8 @@ uint32_t myfont_read_u32(uint8_t** data);
uint32_t myfont_read_u32_as_net(uint8_t** data);
uint32_t myfont_htonl(uint32_t data);
#ifdef __cplusplus
} /* extern "C" */
#endif