Mercurial > hg > octave-lyh
changeset 5544:2286fa5f2e5d
[project @ 2005-11-21 18:44:31 by jwe]
author | jwe |
---|---|
date | Mon, 21 Nov 2005 18:44:32 +0000 |
parents | 4d52e637a72a |
children | c4500e72f503 |
files | src/ChangeLog src/DLD-FUNCTIONS/cellfun.cc src/pr-output.cc |
diffstat | 3 files changed, 40 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2005-11-21 John W. Eaton <jwe@octave.org> + + * pr-output.cc (pr_int): Fix thinko in byte-swapping for bit format. + + * DLD-FUNCTIONS/cellfun.cc (Fcellfun): + Use C++ static_cast instead of C-style casts. + +2005-11-21 William Poetra Yoga H <williampoetra@yahoo.com> + + * DLD-FUNCTIONS/cellfun.cc (Fcellfun): + Docstring and error message fixes. + 2005-11-17 John W. Eaton <jwe@octave.org> * DLD-FUNCTIONS/minmax.cc (MINMAX_BODY): Don't cast arg1 to
--- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -147,21 +147,21 @@ { NDArray result (f_args.dims ()); for (int count= 0; count < k ; count++) - result(count) = double (f_args.elem(count).length ()); + result(count) = static_cast<double> (f_args.elem(count).length ()); retval = result; } else if (name == "ndims") { NDArray result (f_args.dims ()); for (int count = 0; count < k ; count++) - result(count) = double (f_args.elem(count).ndims ()); + result(count) = static_cast<double> (f_args.elem(count).ndims ()); retval = result; } else if (name == "prodofsize") { NDArray result (f_args.dims ()); for (int count = 0; count < k ; count++) - result(count) = double (f_args.elem(count).numel ()); + result(count) = static_cast<double> (f_args.elem(count).numel ()); retval = result; } else if (name == "size") @@ -180,7 +180,7 @@ { dim_vector dv = f_args.elem(count).dims (); if (d < dv.length ()) - result(count) = double (dv(d)); + result(count) = static_cast<double> (dv(d)); else result(count) = 1.0; }
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -1106,6 +1106,12 @@ { if (fmt) { + // Unless explicitly asked for, always print in big-endian + // format for hex and bit formats. + // + // {bit,hex}_format == 1: print big-endian + // {bit,hex}_format == 2: print native + if (hex_format) { equiv tmp; @@ -1151,9 +1157,6 @@ equiv tmp; tmp.d = d; - // Unless explicitly asked for, always print in big-endian - // format. - // XXX FIXME XXX -- is it correct to swap bytes for VAX // formats and not for Cray? @@ -2125,6 +2128,12 @@ size_t sz = d.byte_size(); const unsigned char * tmpi = d.iptr(); + // Unless explicitly asked for, always print in big-endian + // format for hex and bit formats. + // + // {bit,hex}_format == 1: print big-endian + // {bit,hex}_format == 2: print native + if (hex_format) { char ofill = os.fill ('0'); @@ -2148,15 +2157,23 @@ } else if (bit_format) { - if (bit_format > 1 || oct_mach_info::words_big_endian ()) + if (oct_mach_info::words_big_endian ()) { for (size_t i = 0; i < sz; i++) - PRINT_CHAR_BITS_SWAPPED (os, tmpi[i]); + PRINT_CHAR_BITS (os, tmpi[i]); } else { - for (int i = sz - 1; i >= 0; i--) - PRINT_CHAR_BITS (os, tmpi[i]); + if (bit_format > 1) + { + for (size_t i = 0; i < sz; i++) + PRINT_CHAR_BITS_SWAPPED (os, tmpi[i]); + } + else + { + for (int i = sz - 1; i >= 0; i--) + PRINT_CHAR_BITS (os, tmpi[i]); + } } } else