# APKinspector / androguard / specs / dalvik / opcodes / opcode-12-const.html

The default branch has multiple heads

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102``` ``` const

const

Purpose

Move the given literal value (sign-extended to 32 bits, if necessary) into the specified register.

Details

Op & Format Mnemonic / Syntax Arguments
12 11n const/4 vA, #+B A: destination register (4 bits)
B: signed int (4 bits)
13 21s const/16 vAA, #+BBBB A: destination register (8 bits)
B: signed int (16 bits)
14 31i const vAA, #+BBBBBBBB A: destination register (8 bits)
B: arbitrary 32-bit constant
15 21h const/high16 vAA, #+BBBB0000 A: destination register (8 bits)
B: signed int (16 bits)

Constraints

• A must be a valid register index in the current stackframe.

Behavior

• First, an adjusted value B' is determined as follows:
• If we are executing the /high16 variant, then B is left-shifted by 16 bits, that is, B'=B << 0x10
• Otherwise, if B is a 4 bit or 16 bit constant, it is sign-extended to 32 bits, that is, B'=sign-extended(B).
• Otherwise, B'=B.
• Then, the adjusted value B' is moved into the register A, that is, vA'=B'
• If v(A-1) is the lower half of a register pair, v(A-1)' becomes undefined.
• If v(A+1) is the upper half of a register pair, v(A+1)' becomes undefined.

Exceptions

None.

```