Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8314553

primitive_compare doesn't just deal with primitives

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 22
    • 22
    • hotspot

      These were added to make comparison logic easier without messy casts:

      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);
      }

      but the name "primitive" is not right as it is used for pointer types as well. Can we come up with a better name?

      Ref discussions in: https://github.com/openjdk/jdk/pull/15233

            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: