Skip to content

Commit

Permalink
__bfind patch 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbikker committed Dec 6, 2024
1 parent 5a62a92 commit dcdb66f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tiny_bvh.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,13 @@ static unsigned __bfind( unsigned x ) // https://github.com/mackron/refcode/blob
#elif defined(__EMSCRIPTEN__)
return 31 - __builtin_clz( x );
#elif defined(__GNUC__) || defined(__clang__)
#ifndef __APPLE__
unsigned r;
__asm__ __volatile__( "lzcnt{l %1, %0| %0, %1}" : "=r"(r) : "r"(x) : "cc" );
return 31 - r;
#else
return 31 - __builtin_clz( x ); // TODO: unverified.
#endif
#endif
}

Expand Down

0 comments on commit dcdb66f

Please sign in to comment.