@Override public int get(int src) { // RGBA becomes ARGBA by a simple rotation return Integer.rotateRight(src, Byte.SIZE); }
private static int rot(int i, int count) { return Integer.rotateRight(i, count); }
int n = 0x55005500; // Binary 01010101000000000101010100000000 int k = 13; System.err.printf("%08x%n", Integer.rotateRight(n, k));
private void decryptBlock(byte[] in, byte[] out, int off) { int x0 = Bits.readInt(in, off); int x1 = Bits.readInt(in, off + 4); int x2 = Bits.readInt(in, off + 8); int x3 = Bits.readInt(in, off + 12); int k = key; x1 = Integer.rotateRight(x1, x0) ^ k; x3 = Integer.rotateRight(x3, x0) ^ k; x0 = Integer.rotateRight(x0, x1) ^ k; x2 = Integer.rotateRight(x2, x1) ^ k; Bits.writeInt(out, off, x0); Bits.writeInt(out, off + 4, x1); Bits.writeInt(out, off + 8, x2); Bits.writeInt(out, off + 12, x3); }
{ c = rotateRight( c, 30); a -= s4(b, c, d, e,w2[ 64]);} { d = rotateRight( d, 30); b -= s4(c, d, e, a,w2[ 63]);} { e = rotateRight( e, 30); c -= s4(d, e, a, b,w2[ 62]);} { a = rotateRight( a, 30); d -= s4(e, a, b, c,w2[ 61]);} { b = rotateRight( b, 30); e -= s4(a, b, c, d,w2[ 60]);} { c = rotateRight( c, 30); a -= s3(b, c, d, e,w2[ 59]);} { d = rotateRight( d, 30); b -= s3(c, d, e, a,w2[ 58]);} { e = rotateRight( e, 30); c -= s3(d, e, a, b,w2[ 57]);} { a = rotateRight( a, 30); d -= s3(e, a, b, c,w2[ 56]);} { b = rotateRight( b, 30); e -= s3(a, b, c, d,w2[ 55]);} { c = rotateRight( c, 30); a -= s3(b, c, d, e,w2[ 54]);} { d = rotateRight( d, 30); b -= s3(c, d, e, a,w2[ 53]);} { e = rotateRight( e, 30); c -= s3(d, e, a, b,w2[ 52]);} { a = rotateRight( a, 30); d -= s3(e, a, b, c,w2[ 51]);} { b = rotateRight( b, 30); e -= s3(a, b, c, d,w2[ 50]);} { c = rotateRight( c, 30); a -= s3(b, c, d, e,w2[ 49]);} { d = rotateRight( d, 30); b -= s3(c, d, e, a,w2[ 48]);} { e = rotateRight( e, 30); c -= s3(d, e, a, b,w2[ 47]);} { a = rotateRight( a, 30); d -= s3(e, a, b, c,w2[ 46]);} { b = rotateRight( b, 30); e -= s3(a, b, c, d,w2[ 45]);} { c = rotateRight( c, 30); a -= s3(b, c, d, e,w2[ 44]);} { d = rotateRight( d, 30); b -= s3(c, d, e, a,w2[ 43]);} { e = rotateRight( e, 30); c -= s3(d, e, a, b,w2[ 42]);} { a = rotateRight( a, 30); d -= s3(e, a, b, c,w2[ 41]);} { b = rotateRight( b, 30); e -= s3(a, b, c, d,w2[ 40]);} { c = rotateRight( c, 30); a -= s2(b, c, d, e,w2[ 39]);}
public int hashCode() { int result=0; for(int i=0; i<count; i++) { result^=data[i]; result=Integer.rotateRight(result, 1); } return result; }
private int getScrambleDataSector(long fuseId, int partitionNumber) { if (partitionNumber == 3) { return 0x3C22812A; } int scramble = ((int) fuseId) ^ Integer.rotateRight((int) (fuseId >> 32), partitionNumber * 3); scramble ^= 0x556D81FE; if (scramble == 0) { scramble = Integer.rotateRight(0x556D81FE, partitionNumber); } return scramble; }
public static int encrypt(int value, byte key) { int result=value; for (int i=0; i<=(key&255); i++) { result=Integer.rotateRight(result,7)^(i+0xCAFEBABE); } return result; }
public static <T> int hashCode(T[] data) { int result=0; for(int i=0; i<data.length; i++) { result^=data[i].hashCode(); result=Integer.rotateRight(result, 1); } return result; }
public static <T> int hashCode(T[] data) { int result=0; for(int i=0; i<data.length; i++) { result^=data[i].hashCode(); result=Integer.rotateRight(result, 1); } return result; }
public class Binary { public static void main(String[] args) { Integer i = 18; System.out.println(Integer.toBinaryString(i)); i = Integer.rotateRight(i, 2); System.out.println(Integer.toBinaryString(i)); } }
public static final int positiveUnpack2(long packed) { // Move the higher bit as lower bit: if packed >= 0, we then are sure to have a 0 as first bit // Then, this 0 bit it put back as last bit: the integer is guaranteed to be positive return Integer.rotateRight((int) (Long.rotateLeft(packed, 1) & MASK), 1); }
public static<T> int hashCode(Iterator<T> data) { int result=0; while(data.hasNext()) { result^=hashCodeWithNulls(data.next()); result=Integer.rotateRight(result, 1); } return result; }
public static final int positiveUnpack2(long packed) { // Move the higher bit as lower bit: if packed >= 0, we then are sure to have a // 0 as first bit // Then, this 0 bit it put back as last bit: the integer is guaranteed to be // positive return Integer.rotateRight((int) (Long.rotateLeft(packed, 1) & MASK), 1); }
/** Returns a hashcode for this Roi that typically changes if it is moved, even though it is still the same object. */ public int getHashCode() { return hashCode() ^ (new Double(getXBase()).hashCode()) ^ Integer.rotateRight(new Double(getYBase()).hashCode(),16); }
static private void testBitsOps() { System.out.println("testBitsOps:"); System.out.println("Integer.bitCount:" + Integer.bitCount(0x12345678)); System.out.println("Integer.reverse:" + Integer.reverse(0x12345678)); System.out.println("Integer.reverse:" + Integer.reverse(0xF2345678)); System.out.println("Integer.reverseBytes:" + Integer.reverseBytes(0x12345678)); System.out.println("Integer.reverseBytes:" + Integer.reverseBytes(0xF2345678)); System.out.println("Integer.rotateLeft:" + Integer.rotateLeft(0x12345678, 13)); System.out.println("Integer.rotateRight:" + Integer.rotateRight(0xF2345678, 27)); System.out.println("Short.reverseBytes:" + Short.reverseBytes((short) 0x1234)); System.out.println("Short.reverseBytes:" + Short.reverseBytes((short) 0xF234)); }
public final void doWSBH(int rd, int rt) { if (rd != 0) { setRegister(rd, Integer.rotateRight(Integer.reverseBytes(getRegister(rt)), 16)); } }
public int hashCode() { if (blocks.length==0) return 0; int r=blocks[0].hashCode(); for (int i=1; i<blocks.length; i++) { r=Integer.rotateRight(r,blocks[i].size()); r^=blocks[i].hashCode(); } return r; }
public final void doROTRV(int rd, int rt, int rs) { if (rd != 0) { // no need of "getRegister(rs) & 31", rotateRight does it for us setRegister(rd, Integer.rotateRight(getRegister(rt), getRegister(rs))); } }
public int hashCode() { int r= Integer.rotateRight(front.hashCode(),back.size()); r^=back.hashCode(); return r; } }