Skip to content

Commit e97ab5d

Browse files
committed
use PInt.isNegative/Zeor instead of Lt/GtNode-s
1 parent 66acffa commit e97ab5d

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PythonCextBuiltins.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@
231231
import com.oracle.graal.python.builtins.objects.function.PKeyword;
232232
import com.oracle.graal.python.builtins.objects.function.Signature;
233233
import com.oracle.graal.python.builtins.objects.getsetdescriptor.GetSetDescriptor;
234-
import com.oracle.graal.python.builtins.objects.ints.IntBuiltins.GtNode;
235-
import com.oracle.graal.python.builtins.objects.ints.IntBuiltins.LtNode;
236234
import com.oracle.graal.python.builtins.objects.ints.IntBuiltins.NegNode;
237235
import com.oracle.graal.python.builtins.objects.ints.PInt;
238236
import com.oracle.graal.python.builtins.objects.iterator.PSequenceIterator;
@@ -2284,19 +2282,17 @@ int signFalse(boolean b) {
22842282
}
22852283

22862284
@Specialization
2287-
int sign(VirtualFrame frame, PInt n,
2288-
@Cached LtNode ltNode,
2289-
@Cached GtNode gtNode,
2290-
@Cached BranchProfile gtProfile,
2291-
@Cached BranchProfile ltProfile) {
2292-
if ((boolean) gtNode.execute(frame, n, 0)) {
2293-
gtProfile.enter();
2294-
return 1;
2295-
} else if ((boolean) ltNode.execute(frame, n, 0)) {
2296-
ltProfile.enter();
2285+
int sign(PInt n,
2286+
@Cached BranchProfile zeroProfile,
2287+
@Cached BranchProfile negProfile) {
2288+
if (n.isNegative()) {
2289+
negProfile.enter();
22972290
return -1;
2298-
} else {
2291+
} else if (n.isZero()) {
2292+
zeroProfile.enter();
22992293
return 0;
2294+
} else {
2295+
return 1;
23002296
}
23012297
}
23022298

0 commit comments

Comments
 (0)