simple calc
1 | int calc(int i, int j) { |
- variable 0 is
this->aload_0
javap -c
1 | int calc(int, int); |
| a | b |
|---|---|
| [0] | push i value into stack |
| [1] | push j value into stack |
| [2] | add; result push stack |
| [3] | push constant 1 into stack |
| [4] | subtract; push result |
| [5] | j value push stack |
| [6] | push constant 1 again |
| [7] | subtract; push result |
| [8] | push constant -1 |
| [9] | do XOR; push result |
| [10] | do AND; push result |
| [11] | return int |
~(j-1)transform into-1^(j-1)
exclusive or,-1bytes is all high bit.
any int oxr with all high bit, the high bit will be low, low will be high.