Skip to content

Commit

Permalink
sunindextype to int in macros
Browse files Browse the repository at this point in the history
  • Loading branch information
maggul committed Nov 13, 2024
1 parent 2948ef6 commit 4d3ac42
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/arkode/arkode_lsrkstep_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ extern "C" {
*
* SUNRcosh calls the appropriate version of cosh
*
* SUNIceil calls the appropriate version of ceil and returns sunindextype
* SUNIceil calls the appropriate version of ceil and returns int
*
* SUNIfloor calls the appropriate version of floor and returns sunindextype
* SUNIfloor calls the appropriate version of floor and returns int
*
* SUNIround calls the appropriate version of round and returns sunindextype
* SUNIround calls the appropriate version of round and returns int
* -----------------------------------------------------------------
*/

Expand Down Expand Up @@ -123,20 +123,20 @@ extern "C" {
* -----------------------------------------------------------------
* Function : SUNIceil
* -----------------------------------------------------------------
* Usage : sunindextype ceil_x;
* Usage : int ceil_x;
* ceil_x = SUNIceil(x);
* -----------------------------------------------------------------
* SUNIceil(x) returns the smallest sunindextype value not less than x.
* SUNIceil(x) returns the smallest int value not less than x.
* -----------------------------------------------------------------
*/

#ifndef SUNIceil
#if defined(SUNDIALS_DOUBLE_PRECISION)
#define SUNIceil(x) ((sunindextype)(ceil((x)) + SUN_RCONST(0.5)))
#define SUNIceil(x) ((int)(ceil((x)) + SUN_RCONST(0.5)))
#elif defined(SUNDIALS_SINGLE_PRECISION)
#define SUNIceil(x) ((sunindextype)(ceilf((x)) + SUN_RCONST(0.5)))
#define SUNIceil(x) ((int)(ceilf((x)) + SUN_RCONST(0.5)))
#elif defined(SUNDIALS_EXTENDED_PRECISION)
#define SUNIceil(x) ((sunindextype)(ceill((x)) + SUN_RCONST(0.5)))
#define SUNIceil(x) ((int)(ceill((x)) + SUN_RCONST(0.5)))
#else
#error \
"SUNDIALS precision not defined, report to github.com/LLNL/sundials/issues"
Expand All @@ -147,20 +147,20 @@ extern "C" {
* -----------------------------------------------------------------
* Function : SUNIfloor
* -----------------------------------------------------------------
* Usage : sunindextype floor_x;
* Usage : int floor_x;
* floor_x = SUNIfloor(x);
* -----------------------------------------------------------------
* SUNIfloor(x) returns the largest sunindextype value not greater than x.
* SUNIfloor(x) returns the largest int value not greater than x.
* -----------------------------------------------------------------
*/

#ifndef SUNIfloor
#if defined(SUNDIALS_DOUBLE_PRECISION)
#define SUNIfloor(x) ((sunindextype)(floor((x)) + SUN_RCONST(0.5)))
#define SUNIfloor(x) ((int)(floor((x)) + SUN_RCONST(0.5)))
#elif defined(SUNDIALS_SINGLE_PRECISION)
#define SUNIfloor(x) ((sunindextype)(floorf((x)) + SUN_RCONST(0.5)))
#define SUNIfloor(x) ((int)(floorf((x)) + SUN_RCONST(0.5)))
#elif defined(SUNDIALS_EXTENDED_PRECISION)
#define SUNIfloor(x) ((sunindextype)(floorl((x)) + SUN_RCONST(0.5)))
#define SUNIfloor(x) ((int)(floorl((x)) + SUN_RCONST(0.5)))
#else
#error \
"SUNDIALS precision not defined, report to github.com/LLNL/sundials/issues"
Expand All @@ -171,21 +171,21 @@ extern "C" {
* -----------------------------------------------------------------
* Function : SUNIround
* -----------------------------------------------------------------
* Usage : sunindextype round_x;
* Usage : int round_x;
* round_x = SUNIround(x);
* -----------------------------------------------------------------
* SUNIround(x) returns the nearest sunindextype value to x,
* SUNIround(x) returns the nearest int value to x,
* rounding halfway cases away from zero, regardless of the current rounding mode.
* -----------------------------------------------------------------
*/

#ifndef SUNIround
#if defined(SUNDIALS_DOUBLE_PRECISION)
#define SUNIround(x) ((sunindextype)(round((x)) + SUN_RCONST(0.5)))
#define SUNIround(x) ((int)(round((x)) + SUN_RCONST(0.5)))
#elif defined(SUNDIALS_SINGLE_PRECISION)
#define SUNIround(x) ((sunindextype)(roundf((x)) + SUN_RCONST(0.5)))
#define SUNIround(x) ((int)(roundf((x)) + SUN_RCONST(0.5)))
#elif defined(SUNDIALS_EXTENDED_PRECISION)
#define SUNIround(x) ((sunindextype)(roundl((x)) + SUN_RCONST(0.5)))
#define SUNIround(x) ((int)(roundl((x)) + SUN_RCONST(0.5)))
#else
#error \
"SUNDIALS precision not defined, report to github.com/LLNL/sundials/issues"
Expand Down

0 comments on commit 4d3ac42

Please sign in to comment.