Re: two's complement bytes

2008-08-23 Thread Adam W.
On Aug 24, 1:11 am, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 23, 11:52 pm, "Adam W." <[EMAIL PROTECTED]> wrote: > > > > > > > On Aug 24, 12:23 am, castironpi <[EMAIL PROTECTED]> wrote: > > > > Try this out.  Does it come close to what you want? > > > > import struct > > > struct.pack( 'i', ~1

Re: two's complement bytes

2008-08-23 Thread castironpi
On Aug 23, 11:52 pm, "Adam W." <[EMAIL PROTECTED]> wrote: > On Aug 24, 12:23 am, castironpi <[EMAIL PROTECTED]> wrote: > > > Try this out.  Does it come close to what you want? > > > import struct > > struct.pack( 'i', ~10 ) > > ~struct.unpack( 'i', _ )[ 0 ] > > > >>> import struct > > >>> struct.p

Re: two's complement bytes

2008-08-23 Thread Adam W.
On Aug 24, 12:23 am, castironpi <[EMAIL PROTECTED]> wrote: > Try this out.  Does it come close to what you want? > > import struct > struct.pack( 'i', ~10 ) > ~struct.unpack( 'i', _ )[ 0 ] > > > > > > >>> import struct > >>> struct.pack( 'i', ~10 ) > '\xf5\xff\xff\xff' > >>> ~struct.unpack( 'i', _

Re: two's complement bytes

2008-08-23 Thread castironpi
On Aug 23, 10:51 pm, "Adam W." <[EMAIL PROTECTED]> wrote: > I'm dabbling with AVR's for a project I have and that means I have to > use C (ageist my will).  Because my AVR will be tethered to my laptop, > I am writing most of my logic in python, in the hopes of using at > little C as possible. > >