Skip to content

Commit

Permalink
Use int64_t for KLU_INDEXTYPE if SUNDIALS_INT64_T is true. (#477)
Browse files Browse the repository at this point in the history
`long int` is 32 bits wide on systems that use an LLP64 data model
(e.g., Windows). Use a type for which the C standard guarantees that it
is 64-bit instead (i.e., `int64_t`).

See the error in CI for PR #432.

Signed-off-by: Markus Mützel <markus.muetzel@gmx.de>
Co-authored-by: Cody Balos <balos1@llnl.gov>
  • Loading branch information
mmuetzel and balos1 authored May 15, 2024
1 parent d0ed8b3 commit e8b7acd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Fixed a CMake bug that caused an MPI linking error for our C++ examples in some
Fixed a bug in `ARKodeSPRKTable_Create` where the coefficient arrays where not
allocated.

Fix bug on LLP64 platforms (like Windows 64-bit) where `KLU_INDEXTYPE` could be
32 bits wide even if `SUNDIALS_INT64_T` is defined.

## Changes to SUNDIALS in release v7.0.0

### Major Feature
Expand Down
3 changes: 3 additions & 0 deletions doc/shared/RecentChanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ Fixed a CMake bug that caused an MPI linking error for our C++ examples in some

Fixed a bug in :c:func:`ARKodeSPRKTable_Create` where the coefficient arrays
where not allocated.

Fix bug on LLP64 platforms (like Windows 64-bit) where ``KLU_INDEXTYPE`` could be
32 bits wide even if ``SUNDIALS_INT64_T`` is defined.
3 changes: 2 additions & 1 deletion src/sunlinsol/klu/sunlinsol_klu.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* the SUNLINSOL package.
* -----------------------------------------------------------------*/

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sundials/sundials_math.h>
Expand Down Expand Up @@ -49,7 +50,7 @@
*/

#if defined(SUNDIALS_INT64_T)
#define KLU_INDEXTYPE long int
#define KLU_INDEXTYPE int64_t
#else
#define KLU_INDEXTYPE int
#endif
Expand Down

0 comments on commit e8b7acd

Please sign in to comment.