Skip to content
Snippets Groups Projects
Verified Commit 9dff1ff2 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

:bug: Workaround for buggy int64_T and uint64_T types under Windows with MATLAB < R2015b

This bug would impact the qmc_sequence MEX, which manipulates an int64
input/output argument (the seed). Thanks to little-endianness, the bug would
however only manifest for seeds > 2³¹.
parent e9ecce82
No related branches found
No related tags found
No related merge requests found
/* /*
* Copyright © 2009-2020 Dynare Team * Copyright © 2009-2023 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
...@@ -30,4 +30,18 @@ ...@@ -30,4 +30,18 @@
# define mxIsScalar(x) (mxGetM(x) == 1 && mxGetN(x) == 1) # define mxIsScalar(x) (mxGetM(x) == 1 && mxGetN(x) == 1)
#endif #endif
/* The int64_T and uint64_T type are broken under MinGW for MATLAB < R2015b
(they actually alias long integer types, which are 32-bit) */
#if defined(MATLAB_MEX_FILE) && defined(__MINGW64__) && MATLAB_VERSION < 0x0806
# define int64_T long long
# define uint64_T unsigned long long
#endif
#ifdef __cplusplus
static_assert(sizeof(int64_T) == 8, "The int64_T type is buggy");
static_assert(sizeof(uint64_T) == 8, "The uint64_T type is buggy");
#else
_Static_assert(sizeof(int64_T) == 8, "The int64_T type is buggy");
_Static_assert(sizeof(uint64_T) == 8, "The uint64_T type is buggy");
#endif
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment