add more missing `round` defines for compat/msvc.h

Open
#102 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
tooling

Research direction

Start in compat/msvc.h by reading the existing roundf workaround and compare it with the proposed roundd and roundl definitions. Check whether these functions are missing in the targeted earlier MSVC versions, then verify the compatibility build; done means the needed defines are present without breaking supported builds.

Written by the indexing model from the issue text.

Description

Earlier MSVCs are missing some math.h functions that other compilers have. There is already a #define for roundf in msvc.h that works around one of the missing round functions.

I thought I was going to need one or two more round functions so I drafted two additions, but it turns out I do not have a use case at the moment to test these with. For now I'm including the existing roundf define below for reference, along the two new drafts.

#define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f))
#define roundd(in) (in >= 0.0  ? floor(in + 0.5)   : ceil(in - 0.5))
#define roundl(in) (in >= 0.0  ? floor(in + 0.5)   : ceil(in - 0.5))
Dominant language
C
Stars
183
Forks
99
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libretro/libretro-common

All issues in libretro/libretro-common

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.