Mercurial > octave
diff src/pr-output.cc @ 5544:2286fa5f2e5d
[project @ 2005-11-21 18:44:31 by jwe]
author | jwe |
---|---|
date | Mon, 21 Nov 2005 18:44:32 +0000 |
parents | b91241999ba6 |
children | 2618a0750ae6 |
line wrap: on
line diff
--- a/src/pr-output.cc Mon Nov 21 16:13:47 2005 +0000 +++ b/src/pr-output.cc Mon Nov 21 18:44:32 2005 +0000 @@ -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