Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions matlab.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ mxArray* wrap<bool>(const bool& value) {
return result;
}

// specialization to size_t
// specialization to size_t but skip Win64 size check & CUDACC check
Comment thread
thatdudegrantt marked this conversation as resolved.
#if !defined(_WIN64) || defined(__CUDACC__)
template<>
mxArray* wrap<size_t>(const size_t& value) {
mxArray *result = scalar(mxUINT32OR64_CLASS);
*(size_t*)mxGetData(result) = value;
return result;
}
#endif

// specialization to int
template<>
Expand Down Expand Up @@ -345,12 +347,16 @@ uint64_t unwrap<uint64_t>(const mxArray* array) {
return myGetScalar<uint64_t>(array);
}

// specialization to size_t
// specialization to size_t; omit it on Win64 because size_t is uint64_t there
// and would duplicate unwrap<uint64_t>. The __CUDACC__ case intentionally
// bypasses the Win64 guard when compiling with CUDA.
#if !defined(_WIN64) || defined(__CUDACC__)
template<>
size_t unwrap<size_t>(const mxArray* array) {
checkScalar(array, "unwrap<size_t>");
return myGetScalar<size_t>(array);
}
#endif

// specialization to double
template<>
Expand Down
Loading