# Interface: com.pnfsoftware.jeb.core.units.code.android.ir.IDImm

This dual\-purpose `dexdec` IR element serves to encode immediate values \(primitives and pooled strings\) and [evaluated](IDState) values \(primitives and objects\). 

 They can be:
 \- primitives
 \- null objects
 \- pooled `java.lang.String` objects
 \- references to live objects \(including arrays\) living in an [IR state](IDState)
 

 Examples:  

```

 String s = a == 1 ? "hello": null;
                 ^   ^^^^^^^  ^^^^
 
```

## Method: _add
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer addition.
parameter: o: 
return: 

## Method: _and
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a bitwise and operation.
parameter: o: 
return: 

## Method: _cmp
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `int`

Description: Perform a signed operand comparison.
parameter: o: 
return: 0, 1, or \-1

## Method: _cmpU
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `int`

Description: Perform an unsigned operand comparison.
parameter: o: 
return: 0, 1, or \-1

## Method: _div
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer division.
parameter: o: 
return: 

## Method: _isPowerOf2
- return type: `boolean`

Description: Determine whether this immediate \(treated as an unsigned integer\) is a power of 2.
return: 

## Method: _log2
- return type: `java.lang.Integer`

Description: Perform an exact log2 on this immediate treated as an unsigned integer. If the immediate is not a power of 2, a null value is returned.
return: a non\-null log2 of this immediate

## Method: _mul
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer multiplication.
parameter: o: 
return: 

## Method: _neg
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer negation.
parameter: o: 
return: 

## Method: _not
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a bitwise not operation.
parameter: o: 
return: 

## Method: _or
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a bitwise or operation.
parameter: o: 
return: 

## Method: _pow
- parameter: `exponent`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an exponentiation.
parameter: exponent: must be positive or zero
return: 

## Method: _rem
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer modulo operation.
parameter: o: 
return: 

## Method: _sar
- parameter: `cnt`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an arithmetic right\-shift operation \(sign bit is maintained\). The effective count is computed modulo\-positive 32 or 64, depending on the type of this integer.
parameter: cnt: 
return: 

## Method: _shl
- parameter: `cnt`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a left\-shift operation. The effective count is computed modulo\-positive 32 or 64, depending on the type of this integer.
parameter: cnt: 
return: 

## Method: _shr
- parameter: `cnt`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a regular right\-shift operation. The effective count is computed modulo\-positive 32 or 64, depending on the type of this integer.
parameter: cnt: 
return: 

## Method: _sub
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform an integer subtraction.
parameter: o: 
return: 

## Method: _testbit
- parameter: `pos`, type: `int`
- return type: `boolean`

Description: Test if a given bit is set.
parameter: pos: 
return: true if set, false if unset

## Method: _xor
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Perform a bitwise xor operation.
parameter: o: 
return: 

## Method: canReadAsLong
- return type: `boolean`

Description: 
return: 

## Method: duplicate
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`


## Method: duplicateWithDifferentType
- parameter: `type`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Duplicate this immediate and assign it a different type.
parameter: type: type of the duplicated immediate; note for String constants: although type update            is allowed, it must be a type implementing `java.lang.CharSequence`
return: the duplicated immediate

## Method: getImmediateAsJavaObject
- parameter: `gctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDGlobalContext`
- return type: `java.lang.Object`

Description: Resolve this primitive or pooled string immediate to a Java object: either the effective `String` value if it is a string, or one of boxed primitive object type if it is a primitive.
parameter: gctx: 
return: 

## Method: getObjectReferenceId
- return type: `int`

Description: Get the reference object id. The value returned by this method is moot unless [#isRef()](#isRef()) is true.
return: 

## Method: getRawValue
- return type: `long`

Description: Retrieve the raw value encoded by this immediate. All values \(primitives, pool indices, object references\) can fit on a `long`; hence this method's return type.
return: 

## Method: getStringIndex
- return type: `int`

Description: Retrieve the pool index of a pooled string immediate. This method will fail unless [#isString()](#isString()) is `true`.
return: 

## Method: getStringValue
- parameter: `gctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDGlobalContext`
- return type: `java.lang.String`

Description: Resolve the pooled string constant to its effective value. This method will throw if this immediate is not [a string constant](#isStringConstant()).
parameter: gctx: 
return: 

## Method: getValueAsLong
- return type: `long`

Description: 
return: 

## Method: isNonNullRef
- return type: `boolean`

Description: Determine whether this immediate is a non\-null reference. Beware: if the immediate is not typed as an object, this method will return false in all case.
return: 

## Method: isNullRef
- return type: `boolean`

Description: Determine whether this immediate is a null reference. Beware: if the immediate is not typed as an object, this method will return false in all case.
return: 

## Method: isOnes
- return type: `boolean`

Description: Determine whether this immediate has all its bits set to 1. 

 Note: do not mix this up with a zero\-value equality check. That works if the underlying value is to be interpreted as an 2\-complement integer, but may not work if the imm is to be understood as an ieee754 float value, for example.
return: 

## Method: isRef
- return type: `boolean`

Description: Determine whether this immediate is a reference. 

 Note: pooled strings are not treated as references by this method.
return: 

## Method: isString
- return type: `boolean`

Description: Determine whether this immediate is a **pooled string**.
return: 

## Method: isZero
- return type: `boolean`

Description: Determine whether this immediate has all its bits set to 0. 

 Note: do not mix this up with a zero\-value equality check. That works if the underlying value is to be interpreted as an 2\-complement integer, but may not work if the imm is to be understood as an ieee754 float value, for example.
return: 

## Method: isZeroEquivalent
- return type: `boolean`

Description: 
deprecated: use [#isZero()](#isZero()) instead

## Method: maybeNonNullRef
- return type: `boolean`

Description: Determine whether this immediate may be a reference that is not the null reference.
return: 

## Method: maybeNullRef
- return type: `boolean`

Description: Determine whether this immediate may be a reference that is the null reference.
return: 

## Method: maybeRef
- return type: `boolean`

Description: Determine whether this immediate may be a reference. 

 Note: pooled strings are not treated as references by this method.
return: 

## Method: toDouble
- return type: `double`

Description: Evaluate this immediate as a double\-precision float. The immediate must be of type `float` or `double`.
return: 
throws: 

## Method: toFloat
- return type: `float`

Description: Evaluate this immediate as a single\-precision float. The immediate must be of type `float`.
return: 
throws: 

## Method: toLong
- return type: `long`

Description: Evaluate this immediate as a signed long primitive. 

 Note: if this constant is an object reference, the reference id is returned.
return: 
throws: 

## Method: toLong
- parameter: `treatSregAsInt`, type: `boolean`
- return type: `long`

Description: Evaluate this immediate as a signed long primitive. 

 Note: if this constant is an object reference, the reference id is returned.
parameter: treatSregAsInt: if true, and if this object is typed as a            [single\-slot wildcard](IJavaType#isSingleSlotWildcard()), it is treated as a            signed immediate \(and sign\-extension is applied\)
return: 
throws: 

## Method: toUnsignedLong
- return type: `long`

Description: Evaluate this immediate as an unsigned long. 

 Note: if this constant is an object reference, the reference id is returned.
return: 
throws: the type of this immediate does not permit its resolution             to a long primitive

