Macros | Functions
picotm-arithmetic.h File Reference

Public interfaces of picotm's arithmetic module. More...

#include <picotm/compiler.h>
#include <picotm/config/picotm-arithmetic-config.h>

Macros

#define __PICOTM_ARITHMETIC_STATIC_ASSERT_TWOCPL(__type, __min, __max)
 
#define __PICOTM_ARITHMETIC_STATIC_ASSERT_UNSIGNED(__type, __min)
 
#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

PICOTM_NOTHROW void __picotm_arithmetic_error_divbyzero_tx (void)
 
PICOTM_NOTHROW void __picotm_arithmetic_error_overflow_tx (void)
 
PICOTM_NOTHROW void __picotm_arithmetic_error_underflow_tx (void)
 

Macro Definition Documentation

◆ __PICOTM_ARITHMETIC_STATIC_ASSERT_TWOCPL

#define __PICOTM_ARITHMETIC_STATIC_ASSERT_TWOCPL (   __type,
  __min,
  __max 
)

Tests if a signed type uses two's complement.

Warning
This is an internal interface. Don't use it in application code.

◆ __PICOTM_ARITHMETIC_STATIC_ASSERT_UNSIGNED

#define __PICOTM_ARITHMETIC_STATIC_ASSERT_UNSIGNED (   __type,
  __min 
)

Tests if a type is unsigned.

Warning
This is an internal interface. Don't use it in application code.

◆ 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

◆ __picotm_arithmetic_error_divbyzero_tx()

PICOTM_NOTHROW void __picotm_arithmetic_error_divbyzero_tx ( void  )

Reports a division-by-zero error to the transaction manager.

Warning
This is an internal interface. Don't use it in application code.

◆ __picotm_arithmetic_error_overflow_tx()

PICOTM_NOTHROW void __picotm_arithmetic_error_overflow_tx ( void  )

Reports an overflow error to the transaction manager.

Warning
This is an internal interface. Don't use it in application code.

◆ __picotm_arithmetic_error_underflow_tx()

PICOTM_NOTHROW void __picotm_arithmetic_error_underflow_tx ( void  )

Reports an underflow error to the transaction manager.

Warning
This is an internal interface. Don't use it in application code.