Skip to content
Snippets Groups Projects

tests: Cast abs() result to unsigned int in compare_float().

Merged Elizabeth Figura requested to merge zfigura/vkd3d:pr6 into master
1 unresolved thread

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
    • Author Developer

      I'm not sure if this is the best solution to this, maybe there's something cleverer, but this at least stops the function from treating -1.0 and 4.0 as equal.

    • I thought I wrote an absdiff() function for this exact scenario...

      Oh yeah, it's in the d3d9 tests. It's not terribly clever. All it does is make sure the greater of the two operands is the minuend:

      static inline unsigned int absdiff(unsigned int x, unsigned int y)
      {
          return x > y ? x - y : y - x;
      }

      See wine/dlls/d3d9/tests/visual.c:66. EDIT: Wait, that one didn't go in yet. I could've sworn I had one like that in...

      Edited by Chip Davis
    • Please register or sign in to reply
  • Giovanni Mascellani approved this merge request

    approved this merge request

  • I thought I wrote an absdiff() function for this exact scenario...

    Oh yeah, it's in the d3d9 tests. It's not terribly clever. All it does is make sure the greater of the two operands is the minuend:

    static inline unsigned int absdiff(unsigned int x, unsigned int y)
    {
        return x > y ? x - y : y - x;
    }

    See wine/dlls/d3d9/tests/visual.c:66. EDIT: Wait, that one didn't go in yet. I could've sworn I had one like that in...

    Well, we have compare_uint() in the various Wine D3D tests. So does vkd3d, and we could probably use "return compare_uint(x, y, ulps);" here.

  • added 1 commit

    • c7a5192a - tests: Use compare_uint() in compare_float().

    Compare with previous version

  • Author Developer

    Ah yes, that's better. I knew there'd be something nicer. I've pushed a version that uses compare_uint().

  • Francisco Casas approved this merge request

    approved this merge request

  • Henri Verbeet approved this merge request

    approved this merge request

  • Alexandre Julliard added 28 commits

    added 28 commits

    Compare with previous version

  • Alexandre Julliard approved this merge request

    approved this merge request

Please register or sign in to reply
Loading