fix ambiguous type uint64_t and int64_t in matlab toolbox, happens on gcc 4.8 and boost 1.50

release/4.3a0
Jing Dong 2016-06-14 15:15:14 -04:00
parent bd8129d3f7
commit 16145f5e01
1 changed files with 12 additions and 12 deletions

View File

@ -60,15 +60,15 @@ using namespace boost; // not usual, but for conciseness of generated code
// "Unique" key to signal calling the matlab object constructor with a raw pointer // "Unique" key to signal calling the matlab object constructor with a raw pointer
// to a shared pointer of the same C++ object type as the MATLAB type. // to a shared pointer of the same C++ object type as the MATLAB type.
// Also present in utilities.h // Also present in utilities.h
static const uint64_t ptr_constructor_key = static const boost::uint64_t ptr_constructor_key =
(uint64_t('G') << 56) | (boost::uint64_t('G') << 56) |
(uint64_t('T') << 48) | (boost::uint64_t('T') << 48) |
(uint64_t('S') << 40) | (boost::uint64_t('S') << 40) |
(uint64_t('A') << 32) | (boost::uint64_t('A') << 32) |
(uint64_t('M') << 24) | (boost::uint64_t('M') << 24) |
(uint64_t('p') << 16) | (boost::uint64_t('p') << 16) |
(uint64_t('t') << 8) | (boost::uint64_t('t') << 8) |
(uint64_t('r')); (boost::uint64_t('r'));
//***************************************************************************** //*****************************************************************************
// Utilities // Utilities
@ -244,9 +244,9 @@ template <typename T>
T myGetScalar(const mxArray* array) { T myGetScalar(const mxArray* array) {
switch (mxGetClassID(array)) { switch (mxGetClassID(array)) {
case mxINT64_CLASS: case mxINT64_CLASS:
return (T) *(int64_t*) mxGetData(array); return (T) *(boost::int64_t*) mxGetData(array);
case mxUINT64_CLASS: case mxUINT64_CLASS:
return (T) *(uint64_t*) mxGetData(array); return (T) *(boost::uint64_t*) mxGetData(array);
default: default:
// hope for the best! // hope for the best!
return (T) mxGetScalar(array); return (T) mxGetScalar(array);
@ -349,7 +349,7 @@ mxArray* create_object(const std::string& classname, void *pointer, bool isVirtu
int nargin = 2; int nargin = 2;
// First input argument is pointer constructor key // First input argument is pointer constructor key
input[0] = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL); input[0] = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
*reinterpret_cast<uint64_t*>(mxGetData(input[0])) = ptr_constructor_key; *reinterpret_cast<boost::uint64_t*>(mxGetData(input[0])) = ptr_constructor_key;
// Second input argument is the pointer // Second input argument is the pointer
input[1] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL); input[1] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
*reinterpret_cast<void**>(mxGetData(input[1])) = pointer; *reinterpret_cast<void**>(mxGetData(input[1])) = pointer;