[pypy-svn] pypy default: int_between for the jvm backend
antocuni
commits-noreply at bitbucket.org
Mon Apr 11 12:01:26 CEST 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r43286:e4105b9cc21c
Date: 2011-04-11 09:22 +0000
http://bitbucket.org/pypy/pypy/changeset/e4105b9cc21c/
Log: int_between for the jvm backend
diff --git a/pypy/translator/jvm/src/pypy/PyPy.java b/pypy/translator/jvm/src/pypy/PyPy.java
--- a/pypy/translator/jvm/src/pypy/PyPy.java
+++ b/pypy/translator/jvm/src/pypy/PyPy.java
@@ -38,6 +38,10 @@
public final static int INT_MIN = Integer.MIN_VALUE;
public final static double ULONG_MAX = 18446744073709551616.0;
+ public static boolean int_between(int a, int b, int c) {
+ return a <= b && b < c;
+ }
+
/**
* Compares two unsigned integers (value1 and value2) and returns
* a value greater than, equal to, or less than zero if value 1 is
diff --git a/pypy/translator/jvm/opcodes.py b/pypy/translator/jvm/opcodes.py
--- a/pypy/translator/jvm/opcodes.py
+++ b/pypy/translator/jvm/opcodes.py
@@ -144,6 +144,7 @@
'int_xor_ovf': jvm.IXOR,
'int_floordiv_ovf_zer': jvm.IFLOORDIVZEROVF,
'int_mod_ovf_zer': _check_zer(jvm.IREMOVF),
+ 'int_between': jvm.PYPYINTBETWEEN,
'uint_invert': 'bitwise_negate',
diff --git a/pypy/translator/jvm/typesystem.py b/pypy/translator/jvm/typesystem.py
--- a/pypy/translator/jvm/typesystem.py
+++ b/pypy/translator/jvm/typesystem.py
@@ -927,6 +927,7 @@
CLASSISASSIGNABLEFROM = Method.v(jClass, 'isAssignableFrom', (jClass,), jBool)
STRINGBUILDERAPPEND = Method.v(jStringBuilder, 'append',
(jString,), jStringBuilder)
+PYPYINTBETWEEN = Method.s(jPyPy, 'int_between', (jInt,jInt,jInt), jBool)
PYPYUINTCMP = Method.s(jPyPy, 'uint_cmp', (jInt,jInt,), jInt)
PYPYULONGCMP = Method.s(jPyPy, 'ulong_cmp', (jLong,jLong), jInt)
PYPYUINTMOD = Method.v(jPyPy, 'uint_mod', (jInt, jInt), jInt)
More information about the Pypy-commit
mailing list