Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d588692212afc8c6f37dacf714af894b219b7567
Ticket: 1663473fffffffffffffffffffffffffffffffff
binary scan seems to be losing bits
User & Date: msofer on 2007-02-20 20:09:20
Changes

  1. icomment:
    Logged In: YES 
    user_id=148712
    Originator: NO
    
    The way I understand the last example 
     binary scan \xff\xff\xff b5b* var3 var4
    according to the docs is:
    
    (1) first read 5 bits, ie, the first 5 bits of one byte. The 5 bits are put into var3, the remaining 3 bits are discarded ("Any extra bits in the last byte are ignored."). The first byte is now done with.
    
    (2) now read all the rest.
    
    A slightly different experiment seems to confirm this interpretation (a final answer requires source diving, which I may do later):
    
    % binary scan \xff\xff\xff b8b* var3 var4
    2
    % string length $var3
    8
    % string length $var4
    16
    % binary scan \xff\xff\xff b9b* var3 var4
    2
    % string length $var3
    9
    % string length $var4
    8
    
    
    I do confess that this interpretation has been arrived at *after* seeing the example; the docs may need to be improved?
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. username: "msofer"