On 10/14/23 09:21, Thomas J Powderly wrote:
a casual look saw a _lot_ of bits in a double

so i thought ' how many 7 bit ascii chars could be encoded'?

allowing short messages to be sent

like this:

# encode 9 chars into 64bit container
str="WakeuNnow"
n= 0
for c in str:
     n = n | (ord(c) & 0x7f)
     n = n << 7

print(bin(n))
0b1010111110000111010111100101101010111100001001110110111111101110000000
nsav = n

# get the 9 chars back
n = nsav
l = len(str)
for byt in range(l+1):
     c=n&0x7f
     cl[l-byt] = chr(c)
     n=n>>7

# display the chars retrieved
cl
['W', 'a', 'k', 'e', 'U', 'p', 'N', 'o', 'w', '\x00']


just for s&g

tomp

Chuckle, there is a typu above TomP, the lowercase p is missing from your original string. ;o)>

Neat trick, but only 88.888888889% compression. Other compression methods will beat that. However, one might try it on 100 kilobytes of 7 bit ascii text, then gzip -best its output. Then compare that size to a gzip -best of the original to see if it is an improvement. Then to be amazed, make a pdf of it. The pdf will probably be smaller.


_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis



_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to