Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is uaddCarry actually working? #253

Closed
Groovounet opened this issue Oct 21, 2014 · 1 comment
Closed

Is uaddCarry actually working? #253

Groovounet opened this issue Oct 21, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@Groovounet
Copy link
Member

Just not sure.

@Groovounet Groovounet self-assigned this Oct 21, 2014
@chbaker0
Copy link

It appears to give the incorrect carry. I got these results:

4294967291 + 0: 4294967291 1
4294967291 + 1: 4294967292 1
4294967291 + 2: 4294967293 1
4294967291 + 3: 4294967294 1
4294967291 + 4: 4294967295 1
4294967291 + 5: 0 0
4294967291 + 6: 1 0
4294967291 + 7: 2 1
4294967291 + 8: 3 1
4294967291 + 9: 4 1

with this:

#include <iostream>
#include <glm/glm.hpp>
#include <limits>

void test(unsigned int n)
{
    glm::uint a = std::numeric_limits<glm::uint>::max() - 4,
              b = n,
              carry = 0;
    glm::uint result = glm::uaddCarry(a, b, carry);

    std::cout << a << " + " << b << ": " << result << ' ' << carry << std::endl;
}

int main()
{
    for(unsigned int i = 0; i < 10; ++i)
        test(i);
}

This was on the current master branch.

@Groovounet Groovounet added this to the GLM 0.9.6 milestone Nov 15, 2014
Groovounet pushed a commit that referenced this issue Nov 15, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants