[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MEX MWSIZE_MAX
From: |
David Bateman |
Subject: |
MEX MWSIZE_MAX |
Date: |
Wed, 11 May 2011 23:56:50 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 |
While porting the MTEX package (http://code.google.com/p/mtex/) I came
across another issue that I've been working around, but on reflection
should probably be treated in Octave itself. Matlab defines the macros
MWSIZE_MAX
MWSIZE_MIN
MWINDEX_MAX
MWINDEX_MIN
for use in mex-files, however these values depend on the type used for
the mwsize and mwindex types, although the *_MIN macros are always zero.
I can't use std::numeric_limits<mwsize>::max() to get this value as
mex.h is generally included in C programs and so I have to think of
another way of getting this values. This is complicated by the variable
substitution used to create mxarray.h from mxarray.h.in. What I was
thinking of doing is adding
#if (%USE_64_BIT_IDX_T%)
#define MWSIZE_MAX 9223372036854775807L
#define MWINDEX_MAX 9223372036854775807L
#else
#define MWSIZE_MAX 2147483647
#define MWINDEX_MAX 2147483647
#endif
#define MWSIZE_MIN 0
#define MWINDEX_MIN 0
just below the typedefs for mwsize and mwindex, then also substitute
USE_64_BIT_IDX_T when creating mxarray.h from mxarray.h.in. I could
probably use the values from limits.h directly, though using the numeric
values seems safer to me.
Any objections from making this change in the stable branch?
David
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- MEX MWSIZE_MAX,
David Bateman <=