Skip to content

Fix uSubBorrow in func_integer.inl #1360

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Fletterio
Copy link

Currently uSubBorrow is confused. It reports the borrow for x-y (so 1 if x < y, 0 otherwise) but returns the (cyclic if underflow) result of doing y-x.

https://registry.khronos.org/OpenGL-Refpages/gl4/html/usubBorrow.xhtml states that The value borrow is set to 0 if x ≥ y and to 1 otherwise. That and the usual operand order for subtraction indicates that the current implementation is wrong. I simply fix this by making it return x-y when x >= y and 2^32 + x - y otherwise

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.

1 participant