Integer Arithmetic Intrinsics

The following table lists and describes integer arithmetic intrinsics that you can use across all Intel architectures.

Intrinsic Syntax

Description

int abs(int)

Returns the absolute value of an integer.

long labs(long)

Returns the absolute value of a long integer.

unsigned long _lrotl(unsigned long value, int shift)

Implements 64-bit left rotate of value by shift positions.

unsigned long _lrotr(unsigned long value, int shift)

Implements 64-bit right rotate of value by shift positions.

unsigned int _rotl(unsigned int value, int shift)

Implements 32-bit left rotate of value by shift positions.

unsigned int _rotr(unsigned int value, int shift)

Implements 32-bit right rotate of value by shift positions.

unsigned short _rotwl(unsigned short value, int shift)

Implements 16-bit left rotate of value by shift positions. These intrinsics are not supported on IA-64 architecture-based platforms.

unsigned short _rotwr(unsigned short value, int shift)

Implements 16-bit right rotate of value by shift positions. These intrinsics are not supported on IA-64 architecture-based platforms.

Note iconNote

Passing a constant shift value in the rotate intrinsics results in higher performance.