Skip to content

Commit

Permalink
Showing 1 changed file with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -3029,25 +3029,13 @@ public boolean stringEqualsRopeEquals(DynamicObject string, DynamicObject other)
}

@Specialization(guards = {
"!ropeReferenceEqual(string, other)",
"bytesReferenceEqual(string, other)"
})
public boolean stringEqualsBytesEquals(DynamicObject string, DynamicObject other) {
return true;
}

@Specialization(guards = {
"!ropeReferenceEqual(string, other)",
"!bytesReferenceEqual(string, other)",
"!areComparable(string, other)"
})
public boolean stringEqualNotComparable(DynamicObject string, DynamicObject other) {
return false;
}

@Specialization(guards = {
"!ropeReferenceEqual(string, other)",
"!bytesReferenceEqual(string, other)",
"areComparable(string, other)",
"byteLength(string) != byteLength(other)"
})
@@ -3056,9 +3044,17 @@ public boolean stringEqualDifferentLength(DynamicObject string, DynamicObject ot
}

@Specialization(guards = {
"areComparable(string, other)",
"!ropeReferenceEqual(string, other)",
"!bytesReferenceEqual(string, other)",
"bytesReferenceEqual(string, other)"
})
public boolean stringEqualsBytesEquals(DynamicObject string, DynamicObject other) {
return true;
}

@Specialization(guards = {
"areComparable(string, other)",
"!ropeReferenceEqual(string, other)",
"byteLength(string) == 1",
"byteLength(other) == 1",
"hasRawBytes(string)",
@@ -3072,9 +3068,9 @@ public boolean equalCharacters(DynamicObject string, DynamicObject other) {
}

@Specialization(guards = {
"areComparable(string, other)",
"!ropeReferenceEqual(string, other)",
"!bytesReferenceEqual(string, other)",
"areComparable(string, other)",
"byteLength(string) == byteLength(other)"
}, contains = "equalCharacters")
public boolean fullEqual(DynamicObject string, DynamicObject other) {
@@ -3101,9 +3097,7 @@ protected static boolean bytesReferenceEqual(DynamicObject first, DynamicObject
final Rope firstRope = rope(first);
final Rope secondRope = rope(second);

return firstRope.getCodeRange() == CodeRange.CR_7BIT &&
secondRope.getCodeRange() == CodeRange.CR_7BIT &&
firstRope.getRawBytes() != null &&
return firstRope.getRawBytes() != null &&
firstRope.getRawBytes() == secondRope.getRawBytes();
}

0 comments on commit 0a3baaf

Please sign in to comment.