Mercurial > hg > graal-compiler
changeset 21435:feca840a7d81
NumUtil: add isShort(long).
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 20 May 2015 17:25:23 +0200 |
parents | dc379fc31520 |
children | 9c14c177e8c9 |
files | graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java Wed May 20 16:27:26 2015 +0200 +++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java Wed May 20 17:25:23 2015 +0200 @@ -82,6 +82,13 @@ return (short) x == x; } + /** + * Determines if a given {@code long} value is the range of signed short values. + */ + public static boolean isShort(long x) { + return (short) x == x; + } + public static boolean isUShort(int s) { return s == (s & 0xFFFF); }