Mercurial > hg > octave-lyh
diff src/bitfcns.cc @ 10811:e38c071bbc41
allow user query the maximum array size
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 21 Jul 2010 08:47:34 +0200 |
parents | 57a59eae83cc |
children | b4ebfd675321 |
line wrap: on
line diff
--- a/src/bitfcns.cc +++ b/src/bitfcns.cc @@ -652,3 +652,23 @@ return retval; } + +DEFUN (sizemax, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} sizemax ()\n\ +Return the largest value that is allowed as the size of an array.\n\ +If Octave is compiled with 64-bit indexing, the result is of class int64,\n\ +otherwise it is of class int32. It will be a tiny bit lower than the maximum\n\ +allowable value for that type, as reported by intmax.\n\ +@seealso{intmax}\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () == 0) + retval = octave_int<octave_idx_type> (dim_vector::dim_max); + else + print_usage (); + + return retval; +}