L_abs

Absolute value of a 32-bit integer or fractional value returning a 32-bit result. Returns 0x7FFFFFFF for an input of 0x80000000.

Assumptions

OMR's SA bit was set to 1 at least three cycles before this code, that is, saturation on data ALU results enabled.

Prototype

  Word32 L_abs(Word32 lvar1)

  

  
Example

  long result, l = 0xE0000000;  /*  - 0.25    */

   result = L_abs(s1);

  

  // Expected value of result: 0x20000000 = 0.25