Skip to content
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

ArrayQuaternion::Cmov4( ArrayMaskR mask, const ArrayQuaternion &replacement ) is incorrect #141

Closed
lingfors opened this issue Sep 27, 2020 · 1 comment

Comments

@lingfors
Copy link
Contributor

System Information

  • Ogre Version: 2.2.4
    inline void ArrayQuaternion::Cmov4( ArrayMaskR mask, const ArrayQuaternion &replacement )
    {
        ArrayReal * RESTRICT_ALIAS aChunkBase = &w;
        const ArrayReal * RESTRICT_ALIAS bChunkBase = &w;
        aChunkBase[0] = MathlibC::Cmov4( aChunkBase[0], bChunkBase[0], mask );
        aChunkBase[1] = MathlibC::Cmov4( aChunkBase[1], bChunkBase[1], mask );
        aChunkBase[2] = MathlibC::Cmov4( aChunkBase[2], bChunkBase[2], mask );
        aChunkBase[3] = MathlibC::Cmov4( aChunkBase[3], bChunkBase[3], mask );
    }

is a no-op, since it just sets the value to itself, regardless of what the mask is.

It should be something like:

    inline void ArrayQuaternion::Cmov4( ArrayMaskR mask, const ArrayQuaternion &replacement )
    {
        ArrayReal * RESTRICT_ALIAS aChunkBase = &w;
        const ArrayReal * RESTRICT_ALIAS bChunkBase = &replacement.w;
        aChunkBase[0] = MathlibC::Cmov4( aChunkBase[0], bChunkBase[0], mask );
        aChunkBase[1] = MathlibC::Cmov4( aChunkBase[1], bChunkBase[1], mask );
        aChunkBase[2] = MathlibC::Cmov4( aChunkBase[2], bChunkBase[2], mask );
        aChunkBase[3] = MathlibC::Cmov4( aChunkBase[3], bChunkBase[3], mask );
    }
@darksylinc
Copy link
Member

Thanks for the report and the fix!

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

No branches or pull requests

2 participants