Mercurial > octave
diff libinterp/corefcn/bitfcns.cc @ 27880:31b95261c7d2
Backed out changeset 2890a931e647 (bug #47469)
This requires more thought, and release in version 7 of Octave.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 30 Dec 2019 13:08:47 -0800 |
parents | 2890a931e647 |
children | b442ec6dda5c |
line wrap: on
line diff
--- a/libinterp/corefcn/bitfcns.cc Fri Dec 27 22:23:00 2019 +0100 +++ b/libinterp/corefcn/bitfcns.cc Mon Dec 30 13:08:47 2019 -0800 @@ -946,3 +946,27 @@ %!error <not defined for 'double' objects> intmin ("double") %!error <not defined for 'char' objects> intmin ("char") */ + +DEFUN (sizemax, args, , + doc: /* -*- texinfo -*- +@deftypefn {} {} sizemax () +Return the largest value allowed for the size of an array. + +If Octave is compiled with 64-bit indexing, the result is of class int64, +otherwise it is of class int32. The maximum array size is slightly +smaller than the maximum value allowable for the relevant class as reported +by @code{intmax}. +@seealso{intmax} +@end deftypefn */) +{ + if (args.length () != 0) + print_usage (); + + return octave_value (octave_int<octave_idx_type> (dim_vector::dim_max ())); +} + +/* +%!assert (sizemax () >= (intmax ("int32") - 1)) + +%!error sizemax (0) +*/