-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix out-of-the-box vs2019 support for x86 #60
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yupferris
force-pushed
the
x86-link-debugging
branch
from
June 13, 2021 21:52
863b0fd
to
55029f8
Compare
yupferris
force-pushed
the
x86-link-debugging
branch
3 times, most recently
from
June 13, 2021 22:43
99d2ce2
to
0342ae2
Compare
kusma
reviewed
Jun 14, 2021
kusma
reviewed
Jun 14, 2021
kusma
reviewed
Jun 14, 2021
kusma
reviewed
Jun 14, 2021
yupferris
force-pushed
the
x86-link-debugging
branch
from
June 14, 2021 11:26
0342ae2
to
e70b49d
Compare
Also make all internal storage/arithmetic related to it use doubles. The main motivation for this is that it allows us to work around some of the issues identified in #59, as it avoids 64-bit integer arithmetic altogether. doubles have 52 significand bits, so by keeping track of bytes read by DirectSound, it should be accurate up to 7 million hours or something (as opposed to about 6 hours with 32 bit integers, and even that is a probably a bit overkill actually, except for perhaps a musicdisk and perhaps some extra bits for headroom).
There was a typo here, so the expression was always false, and removing it is equivalent. Additionally, we actually _want_ this definition for x86 builds as well as x64 (verified with vs2019 at least; I'm sure earlier versions behave similarly), which is yet another reason to remove it.
yupferris
force-pushed
the
x86-link-debugging
branch
from
June 14, 2021 11:28
ccb791c
to
e17cb70
Compare
OK, I think I've got a solution I'm happy with now. |
I guess we can also stuff |
kusma
reviewed
Jun 14, 2021
yupferris
force-pushed
the
x86-link-debugging
branch
from
June 14, 2021 18:38
e17cb70
to
289c2cd
Compare
Well we sure took the scenic route, but I think we got where we wanted to 😅 |
kusma
reviewed
Jun 15, 2021
We had these defined in two places, and the definitions were actually divergent. The table size ended up being determined by the size definitions in the cpp file, however, all indexing/usage of the table was determined by the Helpers members. Luckily, this actually behaves exactly as intended, but has the consequence that the table occupies twice as much memory as it should have (and the second half was never touched). This is super nasty, though, so let's clean it up.
The primary motivation is that the previous code relied on a 64-bit left shift, which with MSVC 14.2 and higher targeting x86, would generate code that relied on a function from MSVCRT.lib (not .dll) that we don't implement. By constraining the input range to [1, 2) using 1 + x - floor(x), we guarantee that the phase's exponent is always 0, so we can just take the significand bits without shifting them by the exponent. There's still a right-shift to isolate the significand, but this is by a constant factor, and is thus compiled without any issues. Additionally, because we limit the range this way, we also don't need to take advantage of cosine's symmetry about the y axis, so we remove the abs call as well. This new implementation has almost identical error compared to the previous, and is actually about 10% slower, but it works out-of-the-box on both x86 and x64 in the MinSizeRel configuration without any additional changes, and should still be quite portable.
This is used in more places in the code, especially critical places (eg. the Falcon oscillators), so this should ideally be the faster one, especially now that we don't need to take advantage of cos' symmetry about the y axis.
yupferris
force-pushed
the
x86-link-debugging
branch
from
June 15, 2021 13:20
289c2cd
to
b615cee
Compare
Looks most excellent to me! 🧐 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See commits for further explanation.
Fixes #59.