Skip to content

Commit 8b3f971

Browse files
authored
Add macros for 32/64bit integer printf
1 parent 35dac56 commit 8b3f971

File tree

2 files changed

+112
-6
lines changed

2 files changed

+112
-6
lines changed

lapack-netlib/LAPACKE/include/lapack.h

Lines changed: 97 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <stdlib.h>
1414
#include <stdarg.h>
15+
#include <inttypes.h>
1516

1617
/* It seems all current Fortran compilers put strlen at end.
1718
* Some historical compilers put strlen after the str argument
@@ -80,11 +81,26 @@ extern "C" {
8081

8182
/*----------------------------------------------------------------------------*/
8283
#ifndef lapack_int
83-
#define lapack_int int
84+
#if defined(LAPACK_ILP64)
85+
#define lapack_int int64_t
86+
#else
87+
#define lapack_int int32_t
88+
#endif
89+
#endif
90+
91+
/*
92+
* Integer format string
93+
*/
94+
#ifndef LAPACK_IFMT
95+
#if defined(LAPACK_ILP64)
96+
#define LAPACK_IFMT PRId64
97+
#else
98+
#define LAPACK_IFMT PRId32
99+
#endif
84100
#endif
85101

86102
#ifndef lapack_logical
87-
#define lapack_logical lapack_int
103+
#define lapack_logical lapack_int
88104
#endif
89105

90106
/* f2c, hence clapack and MacOS Accelerate, returns double instead of float
@@ -115,7 +131,7 @@ typedef lapack_logical (*LAPACK_Z_SELECT2)
115131
( const lapack_complex_double*, const lapack_complex_double* );
116132

117133
#define LAPACK_lsame_base LAPACK_GLOBAL(lsame,LSAME)
118-
lapack_logical LAPACK_lsame_base( const char* ca, const char* cb,
134+
lapack_logical LAPACK_lsame_base( const char* ca, const char* cb,
119135
lapack_int lca, lapack_int lcb
120136
#ifdef LAPACK_FORTRAN_STRLEN_END
121137
, size_t, size_t
@@ -21986,6 +22002,84 @@ void LAPACK_ztrsyl_base(
2198622002
#define LAPACK_ztrsyl(...) LAPACK_ztrsyl_base(__VA_ARGS__)
2198722003
#endif
2198822004

22005+
#define LAPACK_ctrsyl3_base LAPACK_GLOBAL(ctrsyl3,CTRSYL3)
22006+
void LAPACK_ctrsyl3_base(
22007+
char const* trana, char const* tranb,
22008+
lapack_int const* isgn, lapack_int const* m, lapack_int const* n,
22009+
lapack_complex_float const* A, lapack_int const* lda,
22010+
lapack_complex_float const* B, lapack_int const* ldb,
22011+
lapack_complex_float* C, lapack_int const* ldc, float* scale,
22012+
float* swork, lapack_int const *ldswork,
22013+
lapack_int* info
22014+
#ifdef LAPACK_FORTRAN_STRLEN_END
22015+
, size_t, size_t
22016+
#endif
22017+
);
22018+
#ifdef LAPACK_FORTRAN_STRLEN_END
22019+
#define LAPACK_ctrsyl3(...) LAPACK_ctrsyl3_base(__VA_ARGS__, 1, 1)
22020+
#else
22021+
#define LAPACK_ctrsyl3(...) LAPACK_ctrsyl3_base(__VA_ARGS__)
22022+
#endif
22023+
22024+
#define LAPACK_dtrsyl3_base LAPACK_GLOBAL(dtrsyl3,DTRSYL3)
22025+
void LAPACK_dtrsyl3_base(
22026+
char const* trana, char const* tranb,
22027+
lapack_int const* isgn, lapack_int const* m, lapack_int const* n,
22028+
double const* A, lapack_int const* lda,
22029+
double const* B, lapack_int const* ldb,
22030+
double* C, lapack_int const* ldc, double* scale,
22031+
lapack_int* iwork, lapack_int const* liwork,
22032+
double* swork, lapack_int const *ldswork,
22033+
lapack_int* info
22034+
#ifdef LAPACK_FORTRAN_STRLEN_END
22035+
, size_t, size_t
22036+
#endif
22037+
);
22038+
#ifdef LAPACK_FORTRAN_STRLEN_END
22039+
#define LAPACK_dtrsyl3(...) LAPACK_dtrsyl3_base(__VA_ARGS__, 1, 1)
22040+
#else
22041+
#define LAPACK_dtrsyl3(...) LAPACK_dtrsyl3_base(__VA_ARGS__)
22042+
#endif
22043+
22044+
#define LAPACK_strsyl3_base LAPACK_GLOBAL(strsyl3,STRSYL3)
22045+
void LAPACK_strsyl3_base(
22046+
char const* trana, char const* tranb,
22047+
lapack_int const* isgn, lapack_int const* m, lapack_int const* n,
22048+
float const* A, lapack_int const* lda,
22049+
float const* B, lapack_int const* ldb,
22050+
float* C, lapack_int const* ldc, float* scale,
22051+
lapack_int* iwork, lapack_int const* liwork,
22052+
float* swork, lapack_int const *ldswork,
22053+
lapack_int* info
22054+
#ifdef LAPACK_FORTRAN_STRLEN_END
22055+
, size_t, size_t
22056+
#endif
22057+
);
22058+
#ifdef LAPACK_FORTRAN_STRLEN_END
22059+
#define LAPACK_strsyl3(...) LAPACK_strsyl3_base(__VA_ARGS__, 1, 1)
22060+
#else
22061+
#define LAPACK_strsyl3(...) LAPACK_strsyl3_base(__VA_ARGS__)
22062+
#endif
22063+
22064+
#define LAPACK_ztrsyl3_base LAPACK_GLOBAL(ztrsyl3,ZTRSYL3)
22065+
void LAPACK_ztrsyl3_base(
22066+
char const* trana, char const* tranb,
22067+
lapack_int const* isgn, lapack_int const* m, lapack_int const* n,
22068+
lapack_complex_double const* A, lapack_int const* lda,
22069+
lapack_complex_double const* B, lapack_int const* ldb,
22070+
lapack_complex_double* C, lapack_int const* ldc, double* scale,
22071+
double* swork, lapack_int const *ldswork,
22072+
lapack_int* info
22073+
#ifdef LAPACK_FORTRAN_STRLEN_END
22074+
, size_t, size_t
22075+
#endif
22076+
);
22077+
#ifdef LAPACK_FORTRAN_STRLEN_END
22078+
#define LAPACK_ztrsyl3(...) LAPACK_ztrsyl3_base(__VA_ARGS__, 1, 1)
22079+
#else
22080+
#define LAPACK_ztrsyl3(...) LAPACK_ztrsyl3_base(__VA_ARGS__)
22081+
#endif
22082+
2198922083
#define LAPACK_ctrtri_base LAPACK_GLOBAL(ctrtri,CTRTRI)
2199022084
void LAPACK_ctrtri_base(
2199122085
char const* uplo, char const* diag,

lapack-netlib/LAPACKE/include/lapacke_config.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,29 @@ extern "C" {
4242

4343
#include <stdlib.h>
4444
#include <stdint.h>
45+
#include <inttypes.h>
4546

4647
#ifndef lapack_int
4748
#if defined(LAPACK_ILP64)
48-
#define lapack_int int64_t
49+
#define lapack_int int64_t
4950
#else
50-
#define lapack_int int32_t
51+
#define lapack_int int32_t
52+
#endif
53+
#endif
54+
55+
/*
56+
* Integer format string
57+
*/
58+
#ifndef LAPACK_IFMT
59+
#if defined(LAPACK_ILP64)
60+
#define LAPACK_IFMT PRId64
61+
#else
62+
#define LAPACK_IFMT PRId32
5163
#endif
5264
#endif
5365

5466
#ifndef lapack_logical
55-
#define lapack_logical lapack_int
67+
#define lapack_logical lapack_int
5668
#endif
5769

5870
#ifndef LAPACK_COMPLEX_CUSTOM

0 commit comments

Comments
 (0)