<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:sabouhallawa@apple.com" title="Said Abou-Hallawa <sabouhallawa@apple.com>"> <span class="fn">Said Abou-Hallawa</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Meaning of OptionSet::contains is unclear when used with OptionSet argument"
   href="https://bugs.webkit.org/show_bug.cgi?id=188501">bug 188501</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>sabouhallawa@apple.com
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Meaning of OptionSet::contains is unclear when used with OptionSet argument"
   href="https://bugs.webkit.org/show_bug.cgi?id=188501#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Meaning of OptionSet::contains is unclear when used with OptionSet argument"
   href="https://bugs.webkit.org/show_bug.cgi?id=188501">bug 188501</a>
              from <span class="vcard"><a class="email" href="mailto:sabouhallawa@apple.com" title="Said Abou-Hallawa <sabouhallawa@apple.com>"> <span class="fn">Said Abou-Hallawa</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=347002&action=diff" name="attach_347002" title="patch">attachment 347002</a> <a href="attachment.cgi?id=347002&action=edit" title="patch">[details]</a></span>
patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=347002&action=review">https://bugs.webkit.org/attachment.cgi?id=347002&action=review</a>

<span class="quote">> Source/WTF/ChangeLog:8
> +        The existing behavior is "contains any" but it is not very clear from the name.</span >

I think contains() should act like containsAll(). When I say

    options1.contains(options2)

I would expect this expression to be evaluated to true if and only if "all" the bits of options2 are also in options1.

<span class="quote">> Source/WTF/wtf/OptionSet.h:107
> +    constexpr bool containsAny(OptionSet optionSet) const
> +    {
> +        return !!(*this & optionSet);
> +    }</span >

I do not think this is needed. The bitwise & operator overloading can do exactly what this function does. When I say

    if (option1 & options2)

The result of the expression "option1 & options2" is an OptionSet which contains option1.m_storage & option1.m_storage. The bool cast operator will check isEmpty of the the result OptionSet.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>