title: Inline function with one of two parameters as constexpr
body: <p>Assume I have a function with two parameters where first parameter is dynamic but second parameter is always constant known at compile time:</p>
  <pre class="lang-cpp prettyprint-override"><code>uint8_t convert_bcd(uint8_t num, uint8_t mask) {
      uint8_t result = mask &amp; 0x0F &amp; num;
  
      if constexpr ((mask &amp; 0xF0) != 0) // mask is known at compile time, can be optimized
          result += 10 * ((mask &amp; 0xF0 &amp; num) &gt;&gt; 4);
  
      return result;
  }
  </code></pre>
  <p>Example usage</p>
  <pre class="lang-cpp prettyprint-override"><code>uint8_t result1 = convert_bcd(data[0], 0x7F);
  uint8_t result2 = convert_bcd(data[1], 0x3F);
  </code></pre>
  <p>I would want to inline this function (if possible) and tell the compiler that the if condition, which involves only second parameter which always constant, can be resolved at compile time.</p>
  <p>I got confused with <code>inline</code>/<code>const</code>/<code>constexpr</code> and how to apply them in my scenario to optimize the function as much as possible.</p>
  <p>What is the proper idiomatic way to do it in C++?</p>