Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 3/31/2023
Public

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

Document Table of Contents

_addcarry_u32(), _addcarry_u64()

Computes sum of two 32/64 bit wide unsigned integer values and a carry-in and returns the value of carry-out produced by the sum. The corresponding 4th Generation Intel® Core™ Processor extension instructions are ADCX and ADOX.

Syntax

extern unsigned char _addcarry_u32(unsigned char c_in, unsigned int src1, unsigned int src2, unsigned int *sum_out);

extern unsigned char _addcarry_u64(unsigned char c_in, unsigned __int64 src1, unsigned __int64 src2, unsigned __int64 *sum_out);

Parameters

c_in

Value used for determining carry-in value

src1

32/64 bit source integer

src2

32/64 bit source integer

*sum_out

Pointer to memory location where result is stored

Description

The intrinsic computes sum of two 32/64 bit wide integer values, src1 and src2, and a carry-in value. The carry-in value is considered '1' for any non-zero c_in input value or '0' otherwise. The sum is stored to a memory location referenced by sum_out argument:

*sum_out = src1 + src2 + (c_in !=0 ? 1 : 0)

NOTE:

This intrinsic does not perform validity checking of the memory address pointed to by sum_out, thus it cannot be used to find out if the sum produces carry-out without storing result of the sum.

Returns

Returns the value of the intrinsic is a carry-out value generated by sum. The sum result is stored into memory location pointed by sum_out argument.