[webkit-reviews] review granted: [Bug 201316] Add support for CompactPointerTuple<..., OptionSet<...>> : [Attachment 378741] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 25 13:32:31 PDT 2019


Yusuke Suzuki <ysuzuki at apple.com> has granted Daniel Bates
<dbates at webkit.org>'s request for review:
Bug 201316: Add support for CompactPointerTuple<..., OptionSet<...>>
https://bugs.webkit.org/show_bug.cgi?id=201316

Attachment 378741: Patch

https://bugs.webkit.org/attachment.cgi?id=378741&action=review




--- Comment #17 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 378741
  --> https://bugs.webkit.org/attachment.cgi?id=378741
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=378741&action=review

r=me with comment.

> Source/WTF/wtf/CompactPointerTuple.h:77
> +    template<typename T> struct ByteValueTypeAdapter {
> +	   static constexpr uint8_t toByte(T value) { return value; }
> +	   static constexpr T fromByte(uint8_t value) { return
static_cast<T>(value); }
> +    };
> +
> +    template<typename U> struct ByteValueTypeAdapter<OptionSet<U>> {
> +	   static constexpr uint8_t toByte(OptionSet<U> value) { return
value.toRaw(); }
> +	   static constexpr OptionSet<U> fromByte(uint8_t value) { return
OptionSet<U>::fromRaw(value); }
> +    };

How about taking this as a template parameter of `CompactPointerTuple`? Like,

template<typename PointerType, typename Type, typename Adaptor =
ByteValueTypeAdapter<Type>>
class CompactPointerTuple;


More information about the webkit-reviews mailing list