www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/19/10:31:59

X-Authentication-Warning: mail.bio.uva.nl: Host biomacI-138.bio.uva.nl [145.18.167.138] claimed to be [145.18.167.138]
X-Sender: dlanor AT dds DOT nl (Unverified)
Message-Id: <v01540b00b36879f4a788@[145.18.167.138]>
Mime-Version: 1.0
Date: Wed, 19 May 1999 16:31:58 +0200
To: djgpp AT delorie DOT com
From: dlanor AT dds DOT nl (Ronald Landheer)
Subject: Re: Portability and size_t type related question
Reply-To: djgpp AT delorie DOT com

>> > > Most people think that byte is a synonym for 8 bits.
>> > I'm aware of that. But that doesn't make it correct, at least not from
>> > a 'language-lawyer' point of view. Actually, the equivalence of 8 bits
>> > being a byte is a rather recent invention, compared to the use of the
>> > 'byte' in computing. There have been 7-bit bytes, 9-bit ones. 8 bits
>I think 8 bits is minimum.
Nope.. six bits is (for as far as I encountered).

>And define bytewise is Ok. when my file will be copied to 9-bit byte
>machine, I suggest all bytes will go to new bytes, and extra bit will
>be set to 0. By the way my concern is only the system with file
>portability, so I HAVE TO BE ABLE READ THE SAME BINARY FILE. For
>example PNG file, or JPG.
You could also just take the largest byte size you encounter and use that
as default. If you'd encounter 10 bit bytes, your default would be ten bits
per byte (ranging from 0 to 1023). That way, you can use the same
calculations for every machine, because the range of your bytes is always
the same - and your I/O code will be platform independant in this respect.
(All you'd have to do then is write platform dependant I/O libraries for
each platform, to make sure 8-bit (or 6-bit) bytes are read into 10-bit
bytes, which isn't really all that hard, considering character encoding is
based on the same principle (stuffing 8-bit bytes into 6-bit ones and
upping them to 7-bit bytes, into an array of 64 readable characters)..

Greetz!

Dlanor

"Theoratically, I'm a psycho. Practically, I'm just not very practical."


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019