[Wisp-cvs] wisp/users/dig bits.py,1.15,1.16
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-04-27 12:12:12
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv19291 Modified Files: bits.py Log Message: minor fix of Bits.set_single_item Index: bits.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/bits.py,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- bits.py 27 Apr 2003 12:08:16 -0000 1.15 +++ bits.py 27 Apr 2003 12:12:08 -0000 1.16 @@ -52,11 +52,9 @@ def set_single_item (this, index, step, value): # for easy extension if index < 0 or index > len(this._contents): raise IndexError, index - if step == 1: this._contents[index] = chr(value % 0x100) - else: - tpl = this._byte_order + {2: 'H', 4: 'L'}[step] - this._contents[index : index + step] = \ - array('c', pack(tpl, value % (1L << (step << 3)))) + tpl = this._byte_order + {1: 'B', 2: 'H', 4: 'L'}[step] + this._contents[index : index + step] = \ + array('c', pack(tpl, value % (1L << (step << 3)))) def emit_single_item (this, step, value): # for easy extension this.set_single_item(len(this._contents), step, value) def __setitem__ (this, index, value): |