Skip to content

Conversation

@miracoli
Copy link

@miracoli miracoli commented Sep 4, 2020

This fixes #20. If someone attempts to cast a negative SFixed to UFixed this will give the maximum integer for a specific UFixed minus the SFixed value. For example -1 will result to 255 and -1.5 will result to 254.5 etc.
If I am not mistaken, the behavior is therefore similar to that of integers.

@miracoli miracoli force-pushed the supportCastBetweenUFixedAndSFixed branch from ec398c2 to 95dba43 Compare September 8, 2020 09:18
@Pharap
Copy link
Owner

Pharap commented Mar 26, 2021

I am closing this because I have independently created a different solution (#93) to issue #20, which I happen to prefer because it is significantly simpler. Interestingly, it would seem that the implementation I arrived at is more or less functionally equivalent to the solution you created. Had I noticed this sooner, I could have potentially saved myself some testing in regards to the behaviour (i.e. with -1 becoming 255 and -1.5 becoming 254.5 et cetera).

Once again, I appreciate your attempts to contribute to the project (which I hopefully will be able to spend a bit more time on this year).

@Pharap Pharap closed this Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add conversions between SFixed types and UFixed types

2 participants