28.2.49 __builtin_ff1r_32

Architecture

dsPIC33A

Description

Finds the first one-bit from the right. The most right bit is numbered bit 1, increasing towards the most significant bit.

Example:

int result;
int32_t val_1 = 2048;
int32_t val_2 = -2048;
 
result = __builtin_ff1r_32(val_1);
result = __builtin_ff1r_32(val_2);

The first one-bit for 2048 == 0x0000.0800 == 0b0000.0000.0000.0000.0000.1000.0000.0000 is 13.  The first one-bit  for -2048 == 0xFFFF.F800 == 0b1111.1111.1111.1111.1111.1000.0000.0000 is 13.

Prototype

int __builtin_ff1r_32(int32_t x);

Arguments

x   - value to inspect

Return Value

Returns the position of the first one-bit from the right (least-significant bit). The value is sign-extended to an int.

Machine Instruction

ff1r.l

Error Messages

None.