libretro / libretro/libretro-common

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.

Dominant language
C
Stars
180
Forks
98
Avg merge
7h 16m
Merged PRs (30d)
1

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))

Contributor guide

No contributing guide indexed for this repository

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.