Skip to content

Commit

Permalink
Fix nk_roundf() int type casting (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobLoach authored Nov 22, 2024
1 parent 22b712b commit 175ff81
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -6627,7 +6627,7 @@ nk_log10(double n)
NK_LIB float
nk_roundf(float x)
{
return (x >= 0.0) ? nk_ifloorf(x + 0.5) : nk_iceilf(x - 0.5);
return (x >= 0.0f) ? (float)nk_ifloorf(x + 0.5f) : (float)nk_iceilf(x - 0.5f);
}
NK_API struct nk_rect
nk_get_null_rect(void)
Expand Down Expand Up @@ -30698,6 +30698,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
/// - [y]: Minor version with non-breaking API and library changes
/// - [z]: Patch version with no direct changes to the API
///
/// - 2024/11/20 (4.12.2) - Fix int/float type conversion warnings in `nk_roundf`
/// - 2024/03/07 (4.12.1) - Fix bitwise operations warnings in C++20
/// - 2023/11/26 (4.12.0) - Added an alignment option to checkboxes and radio buttons.
/// - 2023/10/11 (4.11.0) - Added nk_widget_disable_begin() and nk_widget_disable_end()
Expand Down
1 change: 1 addition & 0 deletions src/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/// - [y]: Minor version with non-breaking API and library changes
/// - [z]: Patch version with no direct changes to the API
///
/// - 2024/11/20 (4.12.2) - Fix int/float type conversion warnings in `nk_roundf`
/// - 2024/03/07 (4.12.1) - Fix bitwise operations warnings in C++20
/// - 2023/11/26 (4.12.0) - Added an alignment option to checkboxes and radio buttons.
/// - 2023/10/11 (4.11.0) - Added nk_widget_disable_begin() and nk_widget_disable_end()
Expand Down
2 changes: 1 addition & 1 deletion src/nuklear_math.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ nk_log10(double n)
NK_LIB float
nk_roundf(float x)
{
return (x >= 0.0) ? nk_ifloorf(x + 0.5) : nk_iceilf(x - 0.5);
return (x >= 0.0f) ? (float)nk_ifloorf(x + 0.5f) : (float)nk_iceilf(x - 0.5f);
}
NK_API struct nk_rect
nk_get_null_rect(void)
Expand Down

0 comments on commit 175ff81

Please sign in to comment.