On Fri, 18 Aug 2023 01:20:59 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> It is the name `primitive_compare` - I only previously saw it used for 
>> integer types. Using it with pointers seems "wrong". Don't we have to 
>> convert to `intptr_t` to compare pointers numerically anyway?
>
> template<typename K> bool primitive_equals(const K& k0, const K& k1) {
>   return k0 == k1;
> }
> 
> template<typename K> int primitive_compare(const K& k0, const K& k1) {
>   return ((k0 < k1) ? -1 : (k0 == k1) ? 0 : 1);
> }
> 
> 
> This is the primitive_compare we added with one of these patches.  This 
> compares pointers and because of the template, it doesn't need to look like 
> this:
> 
> 
> int Symbol::fast_compare(const Symbol* other) const {
>  return (((uintptr_t)this < (uintptr_t)other) ? -1
>    : ((uintptr_t)this == (uintptr_t) other) ? 0 : 1);
> }
> 
> 
> I can file another RFE so that we can argue about the name.  The name was 
> what we agreed upon earlier, and I showed it with primtiive_equals and 
> primitive_hash because it provides the same sort of default pointer 
> comparison.
> Please file an RFE so that this can be discussed independently of this PR.  
> We can change them all at one time.

[JDK-8314553](https://bugs.openjdk.org/browse/JDK-8314553)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15233#discussion_r1297913877

Reply via email to