Skip to content

Instantly share code, notes, and snippets.

Created January 13, 2013 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4523924 to your computer and use it in GitHub Desktop.
Save anonymous/4523924 to your computer and use it in GitHub Desktop.
public class Bar{
public static void pop2(int a, int b){} // this method is very likely to be inlined
public int indexOf(byte[] bytes, byte toFind, int offset, int length) {
{
int dummy = bytes[offset] + bytes[offset + length - 1];
}
return 1;
}
public int twoVariables(byte[] bytes, byte toFind, int offset, int length) {
{
int dummy = bytes[offset + length - 1];
}
{
int dummy = bytes[offset];
}
return 1;
}
public int assignTwice(byte[] bytes, byte toFind, int offset, int length) {
{
int dummy = bytes[offset + length - 1];
dummy = bytes[offset];
}
return 1;
}
public int useMax(byte[] bytes, byte toFind, int offset, int length) {
Math.max(bytes[offset + length - 1], bytes[offset]);
return 1;
}
public int usePop2Method(byte[] bytes, byte toFind, int offset, int length) {
pop2(bytes[offset + length - 1], bytes[offset]);
return 1;
}
public int useIf(byte[] bytes, byte toFind, int offset, int length) {
if ((bytes[offset] == bytes[offset+length-1])) { }
return 1;
}
/*
Does not compile:
public int compare(byte[] bytes, byte toFind, int offset, int length) {
bytes[offset] == bytes[offset + length - 1];
return 1;
}
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment