Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Integer Arithmetic Intrinsics

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

Intrinsic Syntax

Description

Intrinsics for all Supported Intel® Architectures

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.

Intrinsics for IA-32 and Intel® 64 Architectures

unsigned short _rotwl(unsigned short value, int shift)

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

unsigned short _rotwr(unsigned short value, int shift)

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

NOTE:

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