Add Type comparison methods#2580
Conversation
| Result result = PeekType(0, &type); | ||
| if (!type.IsReferenceWithIndex()) { | ||
| type = Type::Reference; | ||
| type = Type(Type::Reference, kInvalidIndex); |
There was a problem hiding this comment.
This was inconsistent in the code, sometimes Type(Type::Reference, kInvalidIndex) is used, sometimes just a Type::Reference. Now we must use the Type(Type::Reference, kInvalidIndex) form.
| } | ||
| constexpr operator Enum() const { return enum_; } | ||
|
|
||
| friend constexpr bool operator==(const Type a, const Type b) { |
There was a problem hiding this comment.
Is Type or Type& is better?
There was a problem hiding this comment.
Type is probably better, it's a pair of 32-bit values after all. Any modern compiler should be able to optimize it.
Code is based on the work of SoniEx2.
|
Thank you. Do you need more changes? |
SoniEx2
left a comment
There was a problem hiding this comment.
Good thought to make Type(Type::Any) match zero-initialization. We wonder where that's being relied on (an union not being explicitly set?), but otherwise, well done!
|
The |
|
Thank you! |
Code is based on the work of SoniEx2.