File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/ints Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -919,6 +919,11 @@ private BigInteger op(BigInteger a, long b) {
919
919
@ Builtin (name = SpecialMethodNames .__ABS__ , fixedNumOfArguments = 1 )
920
920
@ GenerateNodeFactory
921
921
abstract static class AbsNode extends PythonUnaryBuiltinNode {
922
+ @ Specialization
923
+ boolean pos (boolean arg ) {
924
+ return arg ;
925
+ }
926
+
922
927
@ Specialization (rewriteOn = ArithmeticException .class )
923
928
int pos (int arg ) {
924
929
int result = Math .abs (arg );
@@ -1068,6 +1073,11 @@ static BigInteger negate(BigInteger value) {
1068
1073
@ Builtin (name = SpecialMethodNames .__INVERT__ , fixedNumOfArguments = 1 )
1069
1074
@ GenerateNodeFactory
1070
1075
abstract static class InvertNode extends PythonUnaryBuiltinNode {
1076
+ @ Specialization
1077
+ int neg (boolean arg ) {
1078
+ return ~(arg ? 1 : 0 );
1079
+ }
1080
+
1071
1081
@ Specialization
1072
1082
int neg (int arg ) {
1073
1083
return ~arg ;
You can’t perform that action at this time.
0 commit comments