[Wisp-cvs] wisp/users/dig bits.py,1.3,1.4
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-04-26 21:10:43
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv9173 Modified Files: bits.py Log Message: simplified Bits.add_wyde and Bits.add_tetra Index: bits.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/bits.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- bits.py 26 Apr 2003 21:08:40 -0000 1.3 +++ bits.py 26 Apr 2003 21:10:39 -0000 1.4 @@ -47,14 +47,8 @@ this._contents.extend(a) def add_byte (this, ofs, value): this._contents[ofs] = chr((ord(this._contents[ofs]) + value) % 0x100) - def _add (this, ofs, value, size, tpl): - datum, = unpack(tpl, this._contents[ofs : ofs + size]) - datum += value - datum %= 1L << (size << 3) - this._contents[ofs : ofs + size] = \ - array('c', pack(this._byte_order + tpl, datum)) - def add_wyde (this, ofs, value): this._add(ofs, value, 2, 'H') - def add_tetra (this, ofs, value): this._add(ofs, value, 4, 'L') + def add_wyde (this, ofs, value): this[ofs::2] += value + def add_tetra (this, ofs, value): this[ofs::4] += value def __getitem__ (this, index): if isinstance(index, SliceType): |