8038953: Add sanity tests for BMI1 and LZCNT instructions

Reviewed-by: kvn, iignatyev
This commit is contained in:
Anton Ivanov 2014-04-11 00:34:51 +04:00 committed by Igor Ignatyev
parent 522abfc113
commit 2b032b10e1
15 changed files with 851 additions and 1 deletions

View file

@ -294,4 +294,23 @@ public final class Utils {
return output;
}
private static final char[] hexArray = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
/**
* Returns hex view of byte array
*
* @param bytes byte array to process
* @return Space separated hexadecimal string representation of bytes
*/
public static String toHexString(byte[] bytes) {
char[] hexView = new char[bytes.length * 3];
int i = 0;
for (byte b : bytes) {
hexView[i++] = hexArray[(b >> 4) & 0x0F];
hexView[i++] = hexArray[b & 0x0F];
hexView[i++] = ' ';
}
return new String(hexView);
}
}