# HG changeset patch # User Josef Eisl # Date 1432135523 -7200 # Node ID feca840a7d8130ac50d461f6df4bcf1464ae524f # Parent dc379fc315208ad6cb86d137b64a79e4739f2ac5 NumUtil: add isShort(long). diff -r dc379fc31520 -r feca840a7d81 graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java --- 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); }