United States    
COMPAQ STORE | PRODUCTS |
SERVICES | SUPPORT | CONTACT US | SEARCH
Compaq C

Compaq C
User's Guide for OpenVMS Systems


Previous Contents Index

6.2.1.13 Atomic AND Longword (__ATOMIC_AND_LONG)

The __ATOMIC_AND_LONG function performs a logical AND of the specified expression with the aligned longword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the longword before the operation was performed.

This function has one of the following formats:

int __ATOMIC_AND_LONG (volatile void *address, int expression);
int __ATOMIC_AND_LONG_RETRY (volatile void *address, int expression, int retry, int *status);

address

The longword-aligned address of the data segment.

expression

An integer expression.

retry

A retry count of type int that indicates the number of times the operation is attempted (which is at least once, even if the retry argument is 0). If the operation cannot be performed successfully in the specified number of retries, the function returns without updating the longword.

status

A pointer to an integer that is set to 0 if the operation did not succeed within the specified number of retries, and set to 1 if the operation succeeded.

Note

The non-RETRY form of this function loops back for a retry unconditionally on failure. This means this function can hang in an endless failure loop.

6.2.1.14 Atomic AND Quadword (__ATOMIC_AND_QUAD)

The __ATOMIC_AND_QUAD function performs a logical AND of the specified expression with the aligned quadword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the quadword before the operation was performed.

This function has one of the following formats:

int __ATOMIC_AND_QUAD (volatile void *address, int expression);
int __ATOMIC_AND_QUAD_RETRY (volatile void *address, int expression, int retry, int *status);

address

The quadword-aligned address of the data segment.

expression

An integer expression.

retry

A retry count of type int that indicates the number of times the operation is attempted (which is at least once, even if the retry argument is 0). If the operation cannot be performed successfully in the specified number of retries, the function returns without updating the quadword.

status

A pointer to an integer that is set to 0 if the operation did not succeed within the specified number of retries, and set to 1 if the operation succeeded.

Note

The non-RETRY form of this function loops back for a retry unconditionally on failure. This means this function can hang in an endless failure loop.

6.2.1.15 Atomic OR Longword (__ATOMIC_OR_LONG)

The __ATOMIC_OR_LONG function performs a logical OR of the specified expression with the aligned longword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the longword before the operation was performed.

This function has one of the following formats:

int __ATOMIC_OR_LONG (volatile void *address, int expression);
int __ATOMIC_OR_LONG_RETRY (volatile void *address, int expression, int retry, int *status);

address

The longword-aligned address of the data segment.

expression

An integer expression.

retry

A retry count of type int that indicates the number of times the operation is attempted (which is at least once, even if the retry argument is 0). If the operation cannot be performed successfully in the specified number of retries, the function returns without updating the longword.

status

A pointer to an integer that is set to 0 if the operation did not succeed within the specified number of retries, and set to 1 if the operation succeeded.

Note

The non-RETRY form of this function loops back for a retry unconditionally on failure. This means this function can hang in an endless failure loop.

6.2.1.16 Atomic OR Quadword (__ATOMIC_OR_QUAD)

The __ATOMIC_OR_QUAD function performs a logical OR of the specified expression with the aligned quadword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the quadword before the operation was performed.

This function has one of the following formats:

int __ATOMIC_OR_QUAD (volatile void *address, int expression);
int __ATOMIC_OR_QUAD_RETRY (volatile void *address, int expression, int retry, int *status);

address

The quadword-aligned address of the data segment.

expression

An integer expression.

retry

A retry count of type int that indicates the number of times the operation is attempted (which is at least once, even if the retry argument is 0). If the operation cannot be performed successfully in the specified number of retries, the function returns without updating the quadword.

status

A pointer to an integer that is set to 0 if the operation did not succeed within the specified number of retries, and set to 1 if the operation succeeded.

Note

The non-RETRY form of this function loops back for a retry unconditionally on failure. This means this function can hang in an endless failure loop.

6.2.1.17 Atomic Increment Longword (__ATOMIC_INCREMENT_LONG)

The __ATOMIC_INCREMENT_LONG function increments by 1 the aligned longword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the longword before the operation was performed.

This function has the following format:

int __ATOMIC_INCREMENT_LONG (volatile void *address);

address

The longword-aligned address of the data segment.

6.2.1.18 Atomic Increment Quadword (__ATOMIC_INCREMENT_QUAD)

The __ATOMIC_INCREMENT_QUAD function increments by 1 the aligned quadword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the quadword before the operation was performed.

This function has the following format:

int __ATOMIC_INCREMENT_QUAD (volatile void *address);

address

The quadword-aligned address of the data segment.

6.2.1.19 Atomic Decrement Longword (__ATOMIC_DECREMENT_LONG)

The __ATOMIC_DECREMENT_LONG function decrements by 1 the aligned longword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the longword before the operation was performed.

This function has the following format:

int __ATOMIC_DECREMENT_LONG (volatile void *address);

address

The longword-aligned address of the data segment.

6.2.1.20 Atomic Decrement Quadword (__ATOMIC_DECREMENT_QUAD)

The __ATOMIC_DECREMENT_QUAD function decrements by 1 the aligned quadword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the quadword before the operation was performed.

This function has the following format:

int __ATOMIC_DECREMENT_QUAD (volatile void *address);

address

The quadword-aligned address of the data segment.

6.2.1.21 Atomic Exchange Longword (__ATOMIC_EXCH_LONG)

The __ATOMIC_EXCH_LONG function stores the value of the specified expression into the aligned longword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the longword before the operation was performed.

This function has one of the following formats:

int __ATOMIC_EXCH_LONG (volatile void *address, int expression);
int __ATOMIC_EXCH_LONG_RETRY (volatile void *address, int expression, int retry, int *status);

address

The longword-aligned address of the data segment.

expression

An integer expression.

retry

A retry count of type int that indicates the number of times the operation is attempted (which is at least once, even if the retry argument is 0). If the operation cannot be performed successfully in the specified number of retries, the function returns without updating the longword.

status

A pointer to an integer that is set to 0 if the operation did not succeed within the specified number of retries, and set to 1 if the operation succeeded.

Note

The non-RETRY form of this function loops back for a retry unconditionally on failure. This means this function can hang in an endless failure loop.

6.2.1.22 Atomic Exchange Quadword (__ATOMIC_EXCH_QUAD)

The __ATOMIC_EXCH_QUAD function stores the value of the specified expression into the aligned quadword pointed to by the address parameter within a load-locked/store-conditional code sequence and returns the value of the quadword before the operation was performed.

This function has one of the following formats:

int __ATOMIC_EXCH_QUAD (volatile void *address, int expression);
int __ATOMIC_EXCH_QUAD_RETRY (volatile void *address, int expression, int retry, int *status);

address

The quadword-aligned address of the data segment.

expression

An integer expression.

retry

A retry count of type int that indicates the number of times the operation is attempted (which is at least once, even if the retry argument is 0). If the operation cannot be performed successfully in the specified number of retries, the function returns without updating the quadword.

status

A pointer to an integer that is set to 0 if the operation did not succeed within the specified number of retries, and set to 1 if the operation succeeded.

Note

The non-RETRY form of this function loops back for a retry unconditionally on failure. This means this function can hang in an endless failure loop.

6.2.1.23 Compare Store Longword ( __CMP_STORE_LONG)

The __CMP_STORE_LONG function has the following format:

int __CMP_STORE_LONG (volatile void *source, int old_value, int new_value, volatile void *dest);

This function performs a conditional atomic compare and update operation involving one or two longwords in the same lock region. The value pointed to by source is compared with the longword old_value. If they are equal, the longword new_value is conditionally stored into the value pointed to by dest.

The store will not complete if the compare yields unequal values or if there is an intervening store to the lock region involved. To be in the same lock region, source and dest must point to aligned longwords in the same naturally aligned 16-byte region.

The function returns 0 if the store does not complete, and returns 1 if the store does complete.

6.2.1.24 Compare Store Quadword ( __CMP_STORE_QUAD)

The __CMP_STORE_QUAD function has the following format:

int __CMP_STORE_QUAD (volatile void *source, int64 old_value, int64 new_value, volatile void *dest);

This function performs a conditional atomic compare and update operation involving one or two quadwords in the same lock region. The value pointed to by source is compared with the quadword old_value. If they are equal, the quadword new_value is conditionally stored into the value pointed to by dest.

The store will not complete if the compare yields unequal values or if there is an intervening store to the lock region involved. To be in the same lock region, source and dest must point to aligned quadwords in the same naturally aligned 16-byte region.

The function returns 0 if the store does not complete, and returns 1 if the store does complete.

6.2.1.25 Convert G_Floating to F_Floating Chopped ( __CVTGF_C)

The __CVTGF_C function converts a double-precision, VAX G_floating-point number to a single-precision, VAX F_floating-point number. This conversion chops to single-precision; then the 8-bit exponent range is checked for overflow or underflow.

This function has the following format:

float __CVTGF_C (double operand);

operand

A double-precision, VAX floating-point number.

6.2.1.26 Convert G_Floating to Quadword ( __CVTGQ)

The __CVTGQ function rounds a double-precision, VAX floating-point number to a 64-bit integer value and returns the result.

This function has the following format:

int64 __CVTGQ (double operand);

operand

A double-precision, VAX floating-point number.

6.2.1.27 Convert IEEE T_Floating to IEEE S_Floating Chopped ( __CVTTS_C)

The __CVTTS_C function converts a double-precision, IEEE T_floating-point number to a single-precision, IEEE S_floating-point number. This conversion chops to single-precision; then the 8-bit exponent range is checked for overflow or underflow.

This function has the following format:

float __CVTTS_C (double operand);

operand

A double-precision, IEEE floating-point number.

6.2.1.28 Convert IEEE T_Floating to Quadword ( __CVTTQ)

The __CVTTQ function rounds a double-precision, IEEE T_floating-point number to a 64-bit integer value and returns the result.

This function has the following format:

int64 __CVTTQ (double operand);

operand

A double-precision, IEEE T_floating-point number.

6.2.1.29 Convert X_Floating to Quadword ( __CVTXQ)

The __CVTXQ function converts an X_floating-point number to a 64-bit integer value and returns the result.

This function has the following format:

int64 __CVTXQ (long double operand);

operand

An X_floating-point number.

6.2.1.30 Convert X_Floating to IEEE T_Floating Chopped ( __CVTXT_C)

The __CVTXT_C function converts an X_floating-point number to an IEEE T_floating-point number and returns the result.

This function has the following format:

double __CVTXT_C (long double operand);

operand

An X_floating-point number.

6.2.1.31 Copy Sign Built-in Functions

Built-in functions are provided to copy selected portions of single- and double-precision, floating-point numbers.

These built-in functions have the following format:

float __CPYSF (float operand1, float operand2);
double __CPYS (double operand1, double operand2);
float __CPYSNF (float operand1, float operand2);
double __CPYSN (double operand1, double operand2);
float __CPYSEF (float operand1, float operand2);
double __CPYSE (double operand1, double operand2);

The copy sign built-ins (__CPYSF and __CPYS) fetch the sign bit in operand1, concatenate it with the exponent and fraction bits from operand2, and return the result.

The copy sign negate built-ins (__CPYSNF and __CPYSN) fetch the sign bit in operand1, complement it, concatenate it with the exponent and fraction bits from operand2, and return the result.

The copy sign exponent built-ins (__CPYSEF and __CPYSE) fetch the sign and exponent bits from operand1, concatenate them with the fraction bits from operand2, and return the result.

6.2.1.32 Cosine ( __COS)

The __COS built-in function is functionally equivalent to its counterpart, cos , in the standard header file <math.h> .

Its format is also the same:

#include <math.h>
double __COS (double x);

x

A radian value.

This built-in offers performance improvements because there is less call overhead associated with its use.

If you include <math.h> , the built-in is automatically used for all occurrences of cos . To disable the built-in, use #undef cos .

6.2.1.33 Double-Precision, Floating-Point Arithmetic Built-in Functions

The following built-in functions provide double-precision, floating-point chopped arithmetic:
__ADDG_C __ADDT_C __SUBG_C __SUBT_C
__MULG_C __MULT_C __DIVG_C __DIVT_C

They have the following format:

double __op{G,T}_C (double operand1, double operand2);

Where op is one of ADD, SUB, MUL, DIV, and {G,T} represents VAX or IEEE floating-point arithmetic, respectively.

The result of the arithmetic operation is returned.


Previous Next Contents Index
  

1.800.AT.COMPAQ

privacy and legal statement