How to get an integer from a sequence of bytes

Grant Edwards invalid at invalid.invalid
Mon Jun 3 18:34:04 EDT 2013


On 2013-06-03, Dave Angel <d at davea.name> wrote:
> On 06/03/2013 10:31 AM, Grant Edwards wrote:
>> On 2013-06-03, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
>>> On Sun, 02 Jun 2013 21:25:45 +0200, Mok-Kong Shen
>>> <mok-kong.shen at t-online.de> declaimed the following in
>>> gmane.comp.python.general:
>>>
>>>
>>>> b'7' is the byte with the character 7 in a certain code, so that's
>>>> ok. In other PLs one assigns an int to a byte, with that int in either
>>>
>>> 	In other languages "byte" is an 8-bit signed/unsigned numeric.
>>
>> That's a common assumption, but historically, a "byte" was merely the
>> smallest addressable unit of memory.  The size of a "byte" on widely
>> used used CPUs ranged from 4 bits to 60 bits.
>>
>
><Hehe> I recall rewriting the unpacking algorithm to get the 10 
> characters from each byte, on such a machine.

Yep.  IIRC there were CDC machines (Cyber 6600?) with a 60-bit wide
"byte" and a 6-bit wide upper-case-only character set.  ISTM that the
Pascal compiler limited you to 6 significant characters in variable
names so that it could use a simple single register compare while
doing symbol lookups...

I think some IBM machines had 60-bit "bytes" as well.

-- 
Grant Edwards               grant.b.edwards        Yow! DIDI ... is that a
                                  at               MARTIAN name, or, are we
                              gmail.com            in ISRAEL?



More information about the Python-list mailing list