The formula seems wrong to me. The max zoom level should be `~~Math.log(size, 2)-8`, because the minimum tile size is 256px, which is 2^8;