isValidSize method
Checks whether or not the int x is a valid size for the Discord CDN query parameter size
.
The size is only valid if it's a power of 2, between 16 and 4096.
NOTE: Apparently, 160 also is a valid size, even though it doesn't meet the requirements.
Implementation
bool isValidSize(int x) {
return (x >= 16) && (x <= 4096) && ((x & (x - 1)) == 0);
}