changeset 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 6683f0c9d742
children 5b68000faac1
files src/ChangeLog src/bitfcns.cc
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Jul 20 21:19:10 2010 +0200
+++ b/src/ChangeLog	Wed Jul 21 08:47:34 2010 +0200
@@ -1,3 +1,7 @@
+2010-07-21  Jaroslav Hajek  <highegg@gmail.com>
+
+	* bitfcns.cc (Fsizemax): New DEFUN.
+
 2010-07-20  Shai Ayal  <shaiay@users.sourceforge.net>
 
 	* DLD-FUNCTIONS/fltk_backend.cc (plot_window::plot_window):
--- a/src/bitfcns.cc	Tue Jul 20 21:19:10 2010 +0200
+++ b/src/bitfcns.cc	Wed Jul 21 08:47:34 2010 +0200
@@ -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;
+}