Commit 44286dc8 by Jamie Madill Committed by Commit Bot

Allow an extra slot in PackedEnumMap.

This can be used for fast lookups with InvalidEnum. Will be useful for optimizing valid primitive mode lookups. Bug: angleproject:2747 Change-Id: I5d668863eb23d3c1eb85a775b3e9e46f25a0a335 Reviewed-on: https://chromium-review.googlesource.com/1171504Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 71bb0267
...@@ -67,11 +67,11 @@ struct AllEnums ...@@ -67,11 +67,11 @@ struct AllEnums
// PackedEnumMap<E, T> is like an std::array<T, E::EnumCount> but is indexed with enum values. It // PackedEnumMap<E, T> is like an std::array<T, E::EnumCount> but is indexed with enum values. It
// implements all of the std::array interface except with enum values instead of indices. // implements all of the std::array interface except with enum values instead of indices.
template <typename E, typename T> template <typename E, typename T, size_t MaxSize = EnumSize<E>()>
class PackedEnumMap class PackedEnumMap
{ {
using UnderlyingType = typename std::underlying_type<E>::type; using UnderlyingType = typename std::underlying_type<E>::type;
using Storage = std::array<T, EnumSize<E>()>; using Storage = std::array<T, MaxSize>;
public: public:
// types: // types:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment