Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor replicate_swizzle optimization.
Do it in two tests instead of three, and with two shifts instead of five.
  • Loading branch information
icculus committed Jul 20, 2020
1 parent e4d4550 commit 6d924fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions profiles/mojoshader_profile_common.c
Expand Up @@ -331,9 +331,9 @@ int writemask_y(const int writemask)

int replicate_swizzle(const int swizzle)
{
return ( (((swizzle >> 0) & 0x3) == ((swizzle >> 2) & 0x3)) &&
(((swizzle >> 2) & 0x3) == ((swizzle >> 4) & 0x3)) &&
(((swizzle >> 4) & 0x3) == ((swizzle >> 6) & 0x3)) );
// elements 1|2 match 3|4 and element 1 matches element 2.
return ( (((swizzle >> 4) & 0xF) == ((swizzle >> 0) & 0xF)) &&
(((swizzle >> 0) & 0x3) == ((swizzle >> 2) & 0x3)) );
} // replicate_swizzle

int no_swizzle(const int swizzle)
Expand Down

0 comments on commit 6d924fd

Please sign in to comment.