# HG changeset patch # User Jaroslav Hajek # Date 1279694854 -7200 # Node ID e38c071bbc417ec29a478416d6aa4ce5df105d1a # Parent 6683f0c9d742ea948e2b15ca427ff9f6adcc5768 allow user query the maximum array size diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-07-21 Jaroslav Hajek + + * bitfcns.cc (Fsizemax): New DEFUN. + 2010-07-20 Shai Ayal * DLD-FUNCTIONS/fltk_backend.cc (plot_window::plot_window): diff --git a/src/bitfcns.cc b/src/bitfcns.cc --- 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 (dim_vector::dim_max); + else + print_usage (); + + return retval; +}