Making mosaic images with ffmpeg
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
383 B

#pragma once
template <typename Int>
bool is_pow_of_two(Int n){
return n && !(n & (n - 1));
}
template <typename Int>
bool is_even(Int n){
return (n & 1) == 0;
}
// calculates integer 2-log such that:
// 2^(two_log(x)) >= x > 2^(two_log(x) - 1)
inline unsigned int two_log(unsigned int x){
if(x <= 1) return 0;
return 8*sizeof(unsigned int) - unsigned(__builtin_clz(x-1));
}