Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Older MSVC versions seem to lack round()
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Oct 27, 2018
1 parent a98fdde commit 1f12b8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libpsautohint/src/ac.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,15 @@ AutoHint(const ACFontInfo* fontinfo, const char* srcbezdata, bool extrahint,
}

#if defined(_MSC_VER) && _MSC_VER < 1800
double
round(double x)
{
return x < 0 ? ceil(x-0.5) : floor(x + 0.5);
}

float
roundf(float x)
{
return (float)((x < 0) ? (ceil((x)-0.5)) : (floor((x) + 0.5)));
return (float)(x < 0 ? ceil(x-0.5) : floor(x + 0.5));
}
#endif
1 change: 1 addition & 0 deletions libpsautohint/src/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef unsigned char bool;
#endif /* _MSC_VER < 1900 */

#if _MSC_VER < 1800
double round(double x);
float roundf(float x);
#endif /* _MSC_VER < 1800 */
#endif /* _MSC_VER */
Expand Down

0 comments on commit 1f12b8f

Please sign in to comment.