Skip to content

Commit

Permalink
Merge pull request #15 from richardeakin/msw_builtin_clz_fix
Browse files Browse the repository at this point in the history
Use MSVC alternative for __builtin_clz()
  • Loading branch information
tgfrerer authored Dec 12, 2020
2 parents 43fbb7a + 992cbe0 commit 2b718dc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/le_backend_vk/le_backend_vk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ vk::SampleCountFlagBits le_sample_count_log_2_to_vk( uint32_t sample_count_log2
// returns log2 of number of samples, so that number of samples can be
// calculated as `num_samples = 1 << log2_num_samples`
inline uint16_t get_sample_count_log_2( uint32_t const &sample_count ) {
#if defined(_MSC_VER)
auto lz = __lzcnt( sample_count );
#else
auto lz = __builtin_clz( sample_count );
#endif
return 31 - lz;
}

Expand Down

0 comments on commit 2b718dc

Please sign in to comment.