Files | Macros | Functions
The Arithmetic Module

The arithmetic module provides safe arithmetics for C types. Overflows or underflows in the type's range are reported as errors to the transaction. More...

Files

file  picotm-arithmetic-ctypes.h
 Transactional, safe arithmetics for native C types.
 
file  picotm-arithmetic.h
 Public interfaces of picotm's arithmetic module.
 

Macros

#define PICOTM_ARITHMETIC_ADD_F_TX(__name, __type, __ext, __idt, __add, __sub)
 
#define PICOTM_ARITHMETIC_ADD_S_TX(__name, __type, __min, __max, __idt, __add, __sub)
 
#define PICOTM_ARITHMETIC_ADD_U_TX(__name, __type, __min, __max, __idt, __add, __sub)
 
#define PICOTM_ARITHMETIC_DIV_F_TX(__name, __type, __ext, __idt, __asb, __mul, __div)
 
#define PICOTM_ARITHMETIC_DIV_S_TX(__name, __type, __min, __max, __idt, __asb, __mul, __div)
 
#define PICOTM_ARITHMETIC_DIV_U_TX(__name, __type, __min, __max, __idt, __asb, __mul, __div)
 
#define PICOTM_ARITHMETIC_MUL_F_TX(__name, __type, __ext, __idt, __asb, __mul, __div)
 
#define PICOTM_ARITHMETIC_MUL_S_TX(__name, __type, __min, __max, __idt, __asb, __mul, __div)
 
#define PICOTM_ARITHMETIC_MUL_U_TX(__name, __type, __min, __max, __idt, __asb, __mul, __div)
 
#define PICOTM_ARITHMETIC_SUB_F_TX(__name, __type, __ext, __idt, __add, __sub)
 
#define PICOTM_ARITHMETIC_SUB_S_TX(__name, __type, __min, __max, __idt, __add, __sub)
 
#define PICOTM_ARITHMETIC_SUB_U_TX(__name, __type, __min, __max, __idt, __add, __sub)
 

Functions

static _Bool add__Bool_tx (_Bool lhs, _Bool rhs)
 
static char add_char_tx (char lhs, char rhs)
 
static double add_double_tx (double lhs, double rhs)
 
static float add_float_tx (float lhs, float rhs)
 
static int add_int_tx (int lhs, int rhs)
 
static long double add_ldouble_tx (long double lhs, long double rhs)
 
static long long add_llong_tx (long long lhs, long long rhs)
 
static long add_long_tx (long lhs, long rhs)
 
static signed char add_schar_tx (signed char lhs, signed char rhs)
 
static short add_short_tx (short lhs, short rhs)
 
static unsigned char add_uchar_tx (unsigned char lhs, unsigned char rhs)
 
static unsigned int add_uint_tx (unsigned int lhs, unsigned int rhs)
 
static unsigned long long add_ullong_tx (unsigned long long lhs, unsigned long long rhs)
 
static unsigned long add_ulong_tx (unsigned long lhs, unsigned long rhs)
 
static unsigned short add_ushort_tx (unsigned short lhs, unsigned short rhs)
 
static _Bool div__Bool_tx (_Bool lhs, _Bool rhs)
 
static char div_char_tx (char lhs, char rhs)
 
static double div_double_tx (double lhs, double rhs)
 
static float div_float_tx (float lhs, float rhs)
 
static int div_int_tx (int lhs, int rhs)
 
static long double div_ldouble_tx (long double lhs, long double rhs)
 
static long long div_llong_tx (long long lhs, long long rhs)
 
static long div_long_tx (long lhs, long rhs)
 
static signed char div_schar_tx (signed char lhs, signed char rhs)
 
static short div_short_tx (short lhs, short rhs)
 
static unsigned char div_uchar_tx (unsigned char lhs, unsigned char rhs)
 
static unsigned int div_uint_tx (unsigned int lhs, unsigned int rhs)
 
static unsigned long long div_ullong_tx (unsigned long long lhs, unsigned long long rhs)
 
static unsigned long div_ulong_tx (unsigned long lhs, unsigned long rhs)
 
static unsigned short div_ushort_tx (unsigned short lhs, unsigned short rhs)
 
static _Bool mul__Bool_tx (_Bool lhs, _Bool rhs)
 
static char mul_char_tx (char lhs, char rhs)
 
static double mul_double_tx (double lhs, double rhs)
 
static float mul_float_tx (float lhs, float rhs)
 
static int mul_int_tx (int lhs, int rhs)
 
static long double mul_ldouble_tx (long double lhs, long double rhs)
 
static long long mul_llong_tx (long long lhs, long long rhs)
 
static long mul_long_tx (long lhs, long rhs)
 
static signed char mul_schar_tx (signed char lhs, signed char rhs)
 
static short mul_short_tx (short lhs, short rhs)
 
static unsigned char mul_uchar_tx (unsigned char lhs, unsigned char rhs)
 
static unsigned int mul_uint_tx (unsigned int lhs, unsigned int rhs)
 
static unsigned long long mul_ullong_tx (unsigned long long lhs, unsigned long long rhs)
 
static unsigned long mul_ulong_tx (unsigned long lhs, unsigned long rhs)
 
static unsigned short mul_ushort_tx (unsigned short lhs, unsigned short rhs)
 
static _Bool sub__Bool_tx (_Bool lhs, _Bool rhs)
 
static char sub_char_tx (char lhs, char rhs)
 
static double sub_double_tx (double lhs, double rhs)
 
static float sub_float_tx (float lhs, float rhs)
 
static int sub_int_tx (int lhs, int rhs)
 
static long double sub_ldouble_tx (long double lhs, long double rhs)
 
static long long sub_llong_tx (long long lhs, long long rhs)
 
static long sub_long_tx (long lhs, long rhs)
 
static signed char sub_schar_tx (signed char lhs, signed char rhs)
 
static short sub_short_tx (short lhs, short rhs)
 
static unsigned char sub_uchar_tx (unsigned char lhs, unsigned char rhs)
 
static unsigned int sub_uint_tx (unsigned int lhs, unsigned int rhs)
 
static unsigned long long sub_ullong_tx (unsigned long long lhs, unsigned long long rhs)
 
static unsigned long sub_ulong_tx (unsigned long lhs, unsigned long rhs)
 
static unsigned short sub_ushort_tx (unsigned short lhs, unsigned short rhs)
 

Detailed Description

The arithmetic module provides safe arithmetic operations for C types. Overflows, underflows and undefined operations are detected and reported to the transaction's recovery code. Supported operations are additions, subtractions, multiplications and divisions.

Additions are in the form add_<type>_tx() where <type> is the name of the C type. For example, overflow-safe addition of two long integer values is performed by the following transaction.

long res = add_long_tx(INT_MAX, INT_MAX);
(picotm_error_as_errno() == ERANGE)) {
// An error happened during an arithmetic operation.
}

The success of this operations depends on the size of type long. If long is 64 bit in size, the addition will return the sum of both operands. If long is only 32 bit in size, which is the same of int on most platforms, the addition will overflow and the function will roll the transaction back to the previous consistent state and report ERANGE to the recovery code.

The arithmetic module comes with support for all native C types. We can define safe addition for application-specific types with the C preprocessor macros PICOTM_ARITHMETIC_ADD_S_TX(), PICOTM_ARITHMETIC_ADD_U_TX() and PICOTM_ARITHMETIC_ADD_F_TX(). The first macro, PICOTM_ARITHMETIC_ADD_S_TX() supports signed integer types; the second macro, PICOTM_ARITHMETIC_ADD_U_TX(), supports unsigned integer types. Finally, the third macro, PICOTM_ARITHMETIC_ADD_F_TX(), supports floating-point types.

For example, an application might use the specialized floating-point type float100, which only contains values from minus 100 to plus 100.

typedef float float100;
#define FLT100_MAX 100 // similar to FLT_MAX from <float.h>

We can use the macro PICOTM_ARITHMETIC_ADD_F_TX() to create an add function that overflows at plus 100 and underflows at minus 100.

float100
float100_add(float100 lhs, float100 rhs)
{
return lhs + rhs;
}
float100
float100_sub(float100 lhs, float100 rhs)
{
return lhs - rhs;
}
PICOTM_ARITHMETIC_ADD_F_TX(float100, float100, FLT100_MAX, 0.f,
float100_add, float_100_sub)

The first two parameters are name and C type of the function. The third parameter is the type's range or extension. For float100 it ranges from -FLT100_MAX to FLT100_MAX. The forth paramater is the value of the type's operation's identity element (i.e., the value that does nothing for the operation). For additions, the identity element is 0. The two final macro parameters are the type's primitive addition and subtraction functions. These functions perform the plain operations without safety checks.

The example macro invocation expands to the following function.

static inline
float100
add_float100_tx(float100 lhs, float100 rhs)
{
... // safe addition
}

A transaction can use it like add_long_tx() in the previous example.

float100 res = add_float100_tx(75.f, 25.f);
(picotm_error_as_errno() == ERANGE)) {
// An error happened during an arithmetic operation.
}

Picotm provides equivalent generator macros for subtraction, multiplication and division of signed integer types, unsigned integer types and floating-point types. Defining subtraction, multiplication and division completes elementary arithmetics for float100. The full example code is shown below.

float100
float100_add(float100 lhs, float100 rhs)
{
return lhs + rhs;
}
float100
float100_sub(float100 lhs, float100 rhs)
{
return lhs - rhs;
}
float100
float100_mul(float100 lhs, float100 rhs)
{
return lhs * rhs;
}
float100
float100_div(float100 lhs, float100 rhs)
{
return lhs / rhs;
}
PICOTM_ARITHMETIC_ADD_F_TX(float100, float100, FLT100_MAX, 0.f,
float100_add, float_100_sub)
PICOTM_ARITHMETIC_SUB_F_TX(float100, float100, FLT100_MAX, 0.f,
float100_add, float_100_sub)
PICOTM_ARITHMETIC_MUL_F_TX(float100, float100, FLT100_MAX, 1.f, 0.f,
float100_mul, float_100_div)
PICOTM_ARITHMETIC_DIV_F_TX(float100, float100, FLT100_MAX, 1.f, 0.f,
float100_div, float_100_div)

The identity element for multiplication and division is 1. In addition to the identity element, the generator macros for multiplication and division take an additional absorbing element. This is the value the maps each factor to the absorbing element itself. For multiplication this value is 0. For divisions by the absorbing element, the generated division function rolls the transaction back and returns the errno code EDOM to the recovery mode.

Results or parameters of arithmetics operations should be loaded into the transaction or stored from the transaction using the Transactional Memory module.

Macro Definition Documentation

◆ PICOTM_ARITHMETIC_ADD_F_TX

#define PICOTM_ARITHMETIC_ADD_F_TX (   __name,
  __type,
  __ext,
  __idt,
  __add,
  __sub 
)

Defines a C function that adds two values of the floating-point C type __type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__extThe type's extension.
__idtThe identity element (i.e., zero) of the type.
__addThe add operation.
__subThe subtract operation.

◆ PICOTM_ARITHMETIC_ADD_S_TX

#define PICOTM_ARITHMETIC_ADD_S_TX (   __name,
  __type,
  __min,
  __max,
  __idt,
  __add,
  __sub 
)

Defines a C function that adds two values of the signed C type __type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__minThe minimum value of the type.
__maxThe maximum value of the type.
__idtThe identity element (i.e., zero) of the type.
__addThe add operation.
__subThe subtract operation.

◆ PICOTM_ARITHMETIC_ADD_U_TX

#define PICOTM_ARITHMETIC_ADD_U_TX (   __name,
  __type,
  __min,
  __max,
  __idt,
  __add,
  __sub 
)

Defines a C function that adds two values of the unsigned C type __type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__minThe minimum value of the type.
__maxThe maximum value of the type.
__idtThe identity element (i.e., zero) of the type.
__addThe add operation.
__subThe subtract operation.

◆ PICOTM_ARITHMETIC_DIV_F_TX

#define PICOTM_ARITHMETIC_DIV_F_TX (   __name,
  __type,
  __ext,
  __idt,
  __asb,
  __mul,
  __div 
)

Defines a C function that divides a values of the floatng-point C type __type by a value of the same type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__extThe type's extension.
__idtThe type's identity element (i.e., one).
__asbThe type's absorbing element (i.e., zero).
__mulThe multiply operation. Should be && for _Bool and * for everything else.
__divThe divide operation. Divisions shall always round towards zero.

◆ PICOTM_ARITHMETIC_DIV_S_TX

#define PICOTM_ARITHMETIC_DIV_S_TX (   __name,
  __type,
  __min,
  __max,
  __idt,
  __asb,
  __mul,
  __div 
)

Defines a C function that divides a values of the signed C type __type by a value of the same type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__minThe type's minimum value.
__maxThe type's maximum value.
__idtThe type's identity element (i.e., one).
__asbThe type's absorbing element (i.e., zero).
__mulThe multiply operation. Should be && for _Bool and * for everything else.
__divThe divide operation. Divisions shall always round towards zero.

◆ PICOTM_ARITHMETIC_DIV_U_TX

#define PICOTM_ARITHMETIC_DIV_U_TX (   __name,
  __type,
  __min,
  __max,
  __idt,
  __asb,
  __mul,
  __div 
)

Defines a C function that divides a values of the unsigned C type __type by a value of the same type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__minThe type's minimum value.
__maxThe type's maximum value.
__idtThe type's identity element (i.e., one).
__asbThe type's absorbing element (i.e., zero).
__mulThe multiply operation. Should be && for _Bool and * for everything else.
__divThe divide operation. Divisions shall always round towards zero.

◆ PICOTM_ARITHMETIC_MUL_F_TX

#define PICOTM_ARITHMETIC_MUL_F_TX (   __name,
  __type,
  __ext,
  __idt,
  __asb,
  __mul,
  __div 
)

Defines a C function that multiplies two values of the floating-point C type __type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__extThe type's extension.
__idtThe type's identity element (i.e., one).
__asbThe type's absorbing element (i.e., zero).
__mulThe multiply operation. Should be && for _Bool and * for everything else.
__divThe divide operation. Divisions shall always round towards zero.

◆ PICOTM_ARITHMETIC_MUL_S_TX

#define PICOTM_ARITHMETIC_MUL_S_TX (   __name,
  __type,
  __min,
  __max,
  __idt,
  __asb,
  __mul,
  __div 
)

Defines a C function that multiplies two values of the signed C type __type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__minThe type's minimum value.
__maxThe type's maximum value.
__idtThe type's identity element (i.e., one).
__asbThe type's absorbing element (i.e., zero).
__mulThe multiply operation. Should be && for _Bool and * for everything else.
__divThe divide operation. Divisions shall always round towards zero.

◆ PICOTM_ARITHMETIC_MUL_U_TX

#define PICOTM_ARITHMETIC_MUL_U_TX (   __name,
  __type,
  __min,
  __max,
  __idt,
  __asb,
  __mul,
  __div 
)

Defines a C function that multiplies two values of the unsigned C type __type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__minThe type's minimum value.
__maxThe type's maximum value.
__idtThe type's identity element (i.e., one).
__asbThe type's absorbing element (i.e., zero).
__mulThe multiply operation. Should be && for _Bool and * for everything else.
__divThe divide operation. Divisions shall always round towards zero.

◆ PICOTM_ARITHMETIC_SUB_F_TX

#define PICOTM_ARITHMETIC_SUB_F_TX (   __name,
  __type,
  __ext,
  __idt,
  __add,
  __sub 
)

Defines a C function that subtracts one value of the floating-point C type __type from another value of the same type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__extThe type's extension.
__idtThe identity element (i.e., zero) of the type.
__addThe add operation.
__subThe subtract operation.

◆ PICOTM_ARITHMETIC_SUB_S_TX

#define PICOTM_ARITHMETIC_SUB_S_TX (   __name,
  __type,
  __min,
  __max,
  __idt,
  __add,
  __sub 
)

Defines a C function that subtracts one value of the signed C type __type from another value of the same type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__minThe minimum value of the type.
__maxThe maximum value of the type.
__idtThe identity element (i.e., zero) of the type.
__addThe add operation.
__subThe subtract operation.

◆ PICOTM_ARITHMETIC_SUB_U_TX

#define PICOTM_ARITHMETIC_SUB_U_TX (   __name,
  __type,
  __min,
  __max,
  __idt,
  __add,
  __sub 
)

Defines a C function that subtracts one value of the unsigned C type __type from another value of the same type.

Parameters
__nameThe name of the value's type.
__typeThe C type of the value.
__minThe minimum value of the type.
__maxThe maximum value of the type.
__idtThe identity element (i.e., zero) of the type.
__addThe add operation.
__subThe subtract operation.

Function Documentation

◆ add__Bool_tx()

static _Bool add__Bool_tx ( _Bool  lhs,
_Bool  rhs 
)
inlinestatic

Adds two values of type _Bool. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.

◆ add_char_tx()

static char add_char_tx ( char  lhs,
char  rhs 
)
inlinestatic

Adds two values of type char. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.

◆ add_double_tx()

static double add_double_tx ( double  lhs,
double  rhs 
)
inlinestatic

Adds two values of type double. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the addition's result underflows the type's range.

◆ add_float_tx()

static float add_float_tx ( float  lhs,
float  rhs 
)
inlinestatic

Adds two values of type float. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the addition's result underflows the type's range.

◆ add_int_tx()

static int add_int_tx ( int  lhs,
int  rhs 
)
inlinestatic

Adds two values of type int. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the addition's result underflows the type's range.

◆ add_ldouble_tx()

static long double add_ldouble_tx ( long double  lhs,
long double  rhs 
)
inlinestatic

Adds two values of type long double. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the addition's result underflows the type's range.

◆ add_llong_tx()

static long long add_llong_tx ( long long  lhs,
long long  rhs 
)
inlinestatic

Adds two values of type long long. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the addition's result underflows the type's range.

◆ add_long_tx()

static long add_long_tx ( long  lhs,
long  rhs 
)
inlinestatic

Adds two values of type long. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the addition's result underflows the type's range.

◆ add_schar_tx()

static signed char add_schar_tx ( signed char  lhs,
signed char  rhs 
)
inlinestatic

Adds two values of type signed char. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the addition's result underflows the type's range.

◆ add_short_tx()

static short add_short_tx ( short  lhs,
short  rhs 
)
inlinestatic

Adds two values of type short. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the addition's result underflows the type's range.

◆ add_uchar_tx()

static unsigned char add_uchar_tx ( unsigned char  lhs,
unsigned char  rhs 
)
inlinestatic

Adds two values of type unsigned char. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.

◆ add_uint_tx()

static unsigned int add_uint_tx ( unsigned int  lhs,
unsigned int  rhs 
)
inlinestatic

Adds two values of type unsigned int. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.

◆ add_ullong_tx()

static unsigned long long add_ullong_tx ( unsigned long long  lhs,
unsigned long long  rhs 
)
inlinestatic

Adds two values of type unsigned long long. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.

◆ add_ulong_tx()

static unsigned long add_ulong_tx ( unsigned long  lhs,
unsigned long  rhs 
)
inlinestatic

Adds two values of type unsigned long. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.

◆ add_ushort_tx()

static unsigned short add_ushort_tx ( unsigned short  lhs,
unsigned short  rhs 
)
inlinestatic

Adds two values of type unsigned short. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side addend.
rhsThe right-hand-side addend.
Returns
The sum of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the addition's result overflows the type's range.

◆ div__Bool_tx()

static _Bool div__Bool_tx ( _Bool  lhs,
_Bool  rhs 
)
inlinestatic

Divides a value of type _Bool by another value of the same type. The function detects divisions by zero, overflows and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.

◆ div_char_tx()

static char div_char_tx ( char  lhs,
char  rhs 
)
inlinestatic

Divides a value of type char by another value of the same type. The function detects divisions by zero, overflows and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.

◆ div_double_tx()

static double div_double_tx ( double  lhs,
double  rhs 
)
inlinestatic

Divides a value of type double by another value of the same type. The function detects divisions by zero, overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.
ERANGEReported to the transaction's recovery phase if the division's result overflows the type's range.

◆ div_float_tx()

static float div_float_tx ( float  lhs,
float  rhs 
)
inlinestatic

Divides a value of type float by another value of the same type. The function detects divisions by zero, overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.
ERANGEReported to the transaction's recovery phase if the division's result overflows the type's range.

◆ div_int_tx()

static int div_int_tx ( int  lhs,
int  rhs 
)
inlinestatic

Divides a value of type int by another value of the same type. The function detects divisions by zero, overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.
ERANGEReported to the transaction's recovery phase if the division's result overflows the type's range.

◆ div_ldouble_tx()

static long double div_ldouble_tx ( long double  lhs,
long double  rhs 
)
inlinestatic

Divides a value of type long double by another value of the same type. The function detects divisions by zero, overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.
ERANGEReported to the transaction's recovery phase if the division's result overflows the type's range.

◆ div_llong_tx()

static long long div_llong_tx ( long long  lhs,
long long  rhs 
)
inlinestatic

Divides a value of type long long by another value of the same type. The function detects divisions by zero, overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.
ERANGEReported to the transaction's recovery phase if the division's result overflows the type's range.

◆ div_long_tx()

static long div_long_tx ( long  lhs,
long  rhs 
)
inlinestatic

Divides a value of type long by another value of the same type. The function detects divisions by zero, overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.
ERANGEReported to the transaction's recovery phase if the division's result overflows the type's range.

◆ div_schar_tx()

static signed char div_schar_tx ( signed char  lhs,
signed char  rhs 
)
inlinestatic

Divides a value of type signed char by another value of the same type. The function detects divisions by zero, overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.
ERANGEReported to the transaction's recovery phase if the division's result overflows the type's range.

◆ div_short_tx()

static short div_short_tx ( short  lhs,
short  rhs 
)
inlinestatic

Divides a value of type short by another value of the same type. The function detects divisions by zero, overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.
ERANGEReported to the transaction's recovery phase if the division's result overflows the type's range.

◆ div_uchar_tx()

static unsigned char div_uchar_tx ( unsigned char  lhs,
unsigned char  rhs 
)
inlinestatic

Divides a value of type unsigned char by another value of the same type. The function detects divisions by zero, overflows and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.

◆ div_uint_tx()

static unsigned int div_uint_tx ( unsigned int  lhs,
unsigned int  rhs 
)
inlinestatic

Divides a value of type unsigned int by another value of the same type. The function detects divisions by zero, overflows and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.

◆ div_ullong_tx()

static unsigned long long div_ullong_tx ( unsigned long long  lhs,
unsigned long long  rhs 
)
inlinestatic

Divides a value of type unsigned long long by another value of the same type. The function detects divisions by zero, overflows and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.

◆ div_ulong_tx()

static unsigned long div_ulong_tx ( unsigned long  lhs,
unsigned long  rhs 
)
inlinestatic

Divides a value of type unsigned long by another value of the same type. The function detects divisions by zero, overflows and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.

◆ div_ushort_tx()

static unsigned short div_ushort_tx ( unsigned short  lhs,
unsigned short  rhs 
)
inlinestatic

Divides a value of type unsigned short by another value of the same type. The function detects divisions by zero, overflows and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side dividend.
rhsThe right-hand-side divisor.
Returns
The fraction of lhs divided by rhs.
Return values
EDOMReported to the transaction's recovery phase if the transaction tries to performed a division by 0.

◆ mul__Bool_tx()

static _Bool mul__Bool_tx ( _Bool  lhs,
_Bool  rhs 
)
inlinestatic

Multiplies two values of type _Bool. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.

◆ mul_char_tx()

static char mul_char_tx ( char  lhs,
char  rhs 
)
inlinestatic

Multiplies two values of type char. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.

◆ mul_double_tx()

static double mul_double_tx ( double  lhs,
double  rhs 
)
inlinestatic

Multiplies two values of type double. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the multiplication's result underflows the type's range.

◆ mul_float_tx()

static float mul_float_tx ( float  lhs,
float  rhs 
)
inlinestatic

Multiplies two values of type float. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the multiplication's result underflows the type's range.

◆ mul_int_tx()

static int mul_int_tx ( int  lhs,
int  rhs 
)
inlinestatic

Multiplies two values of type int. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the multiplication's result underflows the type's range.

◆ mul_ldouble_tx()

static long double mul_ldouble_tx ( long double  lhs,
long double  rhs 
)
inlinestatic

Multiplies two values of type long double. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the multiplication's result underflows the type's range.

◆ mul_llong_tx()

static long long mul_llong_tx ( long long  lhs,
long long  rhs 
)
inlinestatic

Multiplies two values of type long long. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the multiplication's result underflows the type's range.

◆ mul_long_tx()

static long mul_long_tx ( long  lhs,
long  rhs 
)
inlinestatic

Multiplies two values of type long. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the multiplication's result underflows the type's range.

◆ mul_schar_tx()

static signed char mul_schar_tx ( signed char  lhs,
signed char  rhs 
)
inlinestatic

Multiplies two values of type signed char. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the multiplication's result underflows the type's range.

◆ mul_short_tx()

static short mul_short_tx ( short  lhs,
short  rhs 
)
inlinestatic

Multiplies two values of type short. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the multiplication's result underflows the type's range.

◆ mul_uchar_tx()

static unsigned char mul_uchar_tx ( unsigned char  lhs,
unsigned char  rhs 
)
inlinestatic

Multiplies two values of type unsigned char. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.

◆ mul_uint_tx()

static unsigned int mul_uint_tx ( unsigned int  lhs,
unsigned int  rhs 
)
inlinestatic

Multiplies two values of type unsigned int. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.

◆ mul_ullong_tx()

static unsigned long long mul_ullong_tx ( unsigned long long  lhs,
unsigned long long  rhs 
)
inlinestatic

Multiplies two values of type unsigned long long. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.

◆ mul_ulong_tx()

static unsigned long mul_ulong_tx ( unsigned long  lhs,
unsigned long  rhs 
)
inlinestatic

Multiplies two values of type unsigned long. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.

◆ mul_ushort_tx()

static unsigned short mul_ushort_tx ( unsigned short  lhs,
unsigned short  rhs 
)
inlinestatic

Multiplies two values of type unsigned short. The function detects overflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side factor.
rhsThe right-hand-side factor.
Returns
The product of lhs and rhs.
Return values
ERANGEReported to the transaction's recovery phase if the multiplication's result overflows the type's range.

◆ sub__Bool_tx()

static _Bool sub__Bool_tx ( _Bool  lhs,
_Bool  rhs 
)
inlinestatic

Subtracts one value of type _Bool from another value of the same type. The function detects underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_char_tx()

static char sub_char_tx ( char  lhs,
char  rhs 
)
inlinestatic

Subtracts one value of type char from another value of the same type. The function detects underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_double_tx()

static double sub_double_tx ( double  lhs,
double  rhs 
)
inlinestatic

Subtracts one value of type double from another value of the same type. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_float_tx()

static float sub_float_tx ( float  lhs,
float  rhs 
)
inlinestatic

Subtracts one value of type float from another value of the same type. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_int_tx()

static int sub_int_tx ( int  lhs,
int  rhs 
)
inlinestatic

Subtracts one value of type int from another value of the same type. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_ldouble_tx()

static long double sub_ldouble_tx ( long double  lhs,
long double  rhs 
)
inlinestatic

Subtracts one value of type long double from another value of the same type. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_llong_tx()

static long long sub_llong_tx ( long long  lhs,
long long  rhs 
)
inlinestatic

Subtracts one value of type long long from another value of the same type. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_long_tx()

static long sub_long_tx ( long  lhs,
long  rhs 
)
inlinestatic

Subtracts one value of type long from another value of the same type. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_schar_tx()

static signed char sub_schar_tx ( signed char  lhs,
signed char  rhs 
)
inlinestatic

Subtracts one value of type signed char from another value of the same type. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_short_tx()

static short sub_short_tx ( short  lhs,
short  rhs 
)
inlinestatic

Subtracts one value of type short from another value of the same type. The function detects overflows and underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result overflows the type's range.
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_uchar_tx()

static unsigned char sub_uchar_tx ( unsigned char  lhs,
unsigned char  rhs 
)
inlinestatic

Subtracts one value of type unsigned char from another value of the same type. The function detects underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_uint_tx()

static unsigned int sub_uint_tx ( unsigned int  lhs,
unsigned int  rhs 
)
inlinestatic

Subtracts one value of type unsigned int from another value of the same type. The function detects underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_ullong_tx()

static unsigned long long sub_ullong_tx ( unsigned long long  lhs,
unsigned long long  rhs 
)
inlinestatic

Subtracts one value of type unsigned long long from another value of the same type. The function detects underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_ulong_tx()

static unsigned long sub_ulong_tx ( unsigned long  lhs,
unsigned long  rhs 
)
inlinestatic

Subtracts one value of type unsigned long from another value of the same type. The function detects underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.

◆ sub_ushort_tx()

static unsigned short sub_ushort_tx ( unsigned short  lhs,
unsigned short  rhs 
)
inlinestatic

Subtracts one value of type unsigned short from another value of the same type. The function detects underflows of the type's range and reports them as errno code to the transaction's recovery phase.

Parameters
lhsThe left-hand-side minuend.
rhsThe right-hand-side subtrahend.
Returns
The difference from rhs to lhs.
Return values
ERANGEReported to the transaction's recovery phase if the subtraction's result underflows the type's range.