Bit Operations
Gianmaria Iaculo - NVENTA
gianmaria at hotmail.com
Wed Nov 28 16:35:45 EST 2007
U are really nice guys... i'm really apreciating (sorry 4 my bad english)
Chriss is right this are coordinates.... and i'm treating as strings
naturally
I dont really have floating points on my module.. it run a 1.5 python
version from Telit.
So i dont have zLib too... just have 1.5 Mb of Ram and 3Mb of Rom... not
realy confortable..isn't it?
I'm tring some experiments on the command line... i've tried this:
My longitude is 42.237897
so as a first step... i created a X and done this job as your examples:
a = 4
b = 2
x = (a<<4)|b
x is 66
so i can do:
aDecoded = x >> 4
and i have the 4 again...( a value) but i've some problems while i decode
the b....
Where i go wrong?
Gianmaria
Firma Gianmaria Iaculo
"Chris Mellon" <arkanes at gmail.com> ha scritto nel messaggio
news:mailman.1677.1196285028.13605.python-list at python.org...
> On Nov 28, 2007 3:18 PM, J. Clifford Dyer <jcd at sdf.lonestar.org> wrote:
>> On Wed, Nov 28, 2007 at 10:05:40PM +0100, Gianmaria Iaculo - NVENTA wrote
>> regarding Re: Bit Operations:
>> >
>> > Txs all,
>> > i wont to respond to who asked why i needed it:
>> >
>> > I'm using python on GSM modules and the informations i have to move
>> > goes
>> > along GPRS/UMTS connections so it's beatiful for me to transfer more
>> > informations with less space...
>> > imagine i have to send this simple data....
>> >
>> > 41.232323,12.345678
>> >
>> > i can send it as it's or use the nibble trick and on the receiving
>> > station
>> > 'unlift" the data and rebuild the original information...
>> >
>> > isn'it???
>> >
>>
>> Um, no. It isn't. How exactly are you going to pack floating point
>> numbers into a half a byte?
>>
>> Or are you sending it as strings? Also a waste of space, and
>> unnecessarily complex.
>>
>
> Assuming these are coordinates, not floats, using strings makes sense
> but the zlib module is probably a much better choice than a
> hand-written compression scheme.
More information about the Python-list
mailing list