summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-02-10 09:32:37 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-02-10 09:32:37 (GMT)
commitba424f61a038d5f1a7ed8a84ed461f4d5cf67283 (patch)
treeefba4ba75c3b50ea25603e15a0c823ed46654b14
parent217136e964f9b6fde107bad8674e089a6932ab90 (diff)
downloadtcl-ba424f61a038d5f1a7ed8a84ed461f4d5cf67283.zip
tcl-ba424f61a038d5f1a7ed8a84ed461f4d5cf67283.tar.gz
tcl-ba424f61a038d5f1a7ed8a84ed461f4d5cf67283.tar.bz2
More consistency. [Bug 1117017]
-rw-r--r--ChangeLog5
-rw-r--r--doc/binary.n16
2 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index c5eb617..a83b16f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-10 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/binary.n: Made the documentation of sign bit masking and
+ [binary scan] consistent. [Bug 1117017]
+
2005-02-08 David N. Welton <davidw@dedasys.com>
* doc/CrtChannel.3: Typo: return->returns.
diff --git a/doc/binary.n b/doc/binary.n
index 51e9bab..ab98224 100644
--- a/doc/binary.n
+++ b/doc/binary.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: binary.n,v 1.24 2004/11/12 11:03:16 dkf Exp $
+'\" RCS: @(#) $Id: binary.n,v 1.25 2005/02/10 09:33:01 dkf Exp $
'\"
.so man.macros
.TH binary n 8.0 Tcl "Tcl Built-In Commands"
@@ -431,7 +431,7 @@ If you want to produce an unsigned value, then you can mask the return
value to the desired size. For example, to produce an unsigned short
value:
.CS
-set val [expr {$val & 0xFFFF}]; \fI# val == 0x8000\fR
+set val [expr { $val & 0xFFFF }]; \fI# val == 0x8000\fR
.CE
.PP
Each type-count pair moves an imaginary cursor through the binary data,
@@ -529,7 +529,7 @@ stored in \fIvar2\fR. Note that the integers returned are signed, but
they can be converted to unsigned 8-bit quantities using an expression
like:
.CS
-expr { ( $num + 0x100 ) % 0x100 }
+set num [expr { $num & 0xff }]
.CE
.RE
.IP \fBs\fR 5
@@ -548,7 +548,7 @@ stored in \fIvar2\fR. Note that the integers returned are signed, but
they can be converted to unsigned 16-bit quantities using an expression
like:
.CS
-expr { ( $num + 0x10000 ) % 0x10000 }
+set num [expr { $num & 0xffff }]
.CE
.RE
.IP \fBS\fR 5
@@ -583,8 +583,12 @@ set str \\x05\\x00\\x00\\x00\\x07\\x00\\x00\\x00\\xf0\\xff\\xff\\xff
\fBbinary scan\fR $str i2i* var1 var2
.CE
will return \fB2\fR with \fB5 7\fR stored in \fIvar1\fR and \fB-16\fR
-stored in \fIvar2\fR. Note that the integers returned are signed and
-cannot be represented by Tcl as unsigned values.
+stored in \fIvar2\fR. Note that the integers returned are signed, but
+they can be converted to unsigned 32-bit quantities using an expression
+like:
+.CS
+set num [expr { $num & 0xffffffff }]
+.CE
.RE
.IP \fBI\fR 5
This form is the same as \fBI\fR except that the data is interpreted