Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #5114

Re: 64-bit bytes

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.roellig-ltd.de!open-news-network.org!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!post01.fr7!fx12.am4.POSTED!not-for-mail
From BartC <bc@freeuk.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
MIME-Version 1.0
Newsgroups comp.programming
Subject Re: 64-bit bytes
References <1d1b426e-452d-43ac-a15d-31dff9833370@googlegroups.com> <a19e7c48-06e8-4b66-8faf-e7f4b92af0a9@googlegroups.com> <442bffa5-0e87-4924-a8e2-19dc69236183@googlegroups.com> <07379e64-43df-4e01-9506-fee7d5f56c80@googlegroups.com> <GCEsw.973563$CW3.557830@fx07.am4> <GxFsw.532620$td3.314128@fx34.am4> <y9Msw.578728$RM2.35041@fx43.am4> <srOsw.570775$9b1.159484@fx05.am4> <RGOsw.496550$lM6.489669@fx22.am4> <y%Osw.742376$MH.437411@fx12.am4> <874mrwmazc.fsf@ixod.org> <87lhl8t7a2.fsf@bsb.me.uk> <KXQsw.1051659$il4.619865@fx06.am4> <1wjz2viojajea.1kr9ibzhhn9v7.dlg@40tude.net> <oITsw.567851$812.424728@fx20.am4> <1tskc5x9tqkm7$.13yuk96hv2vjx$.dlg@40tude.net>
In-Reply-To <1tskc5x9tqkm7$.13yuk96hv2vjx$.dlg@40tude.net>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Lines 54
Message-ID <F6Vsw.755958$MH.21930@fx12.am4> (permalink)
NNTP-Posting-Host 92.239.254.134
X-Complaints-To http://netreport.virginmedia.com
X-Trace 1421090341 92.239.254.134 (Mon, 12 Jan 2015 19:19:01 UTC)
NNTP-Posting-Date Mon, 12 Jan 2015 19:19:01 UTC
Organization virginmedia.com
Date Mon, 12 Jan 2015 19:18:59 +0000
X-Received-Body-CRC 2891256703
X-Received-Bytes 3132
Xref csiph.com comp.programming:5114

Show key headers only | View raw


On 12/01/2015 18:11, Dmitry A. Kazakov wrote:
> On Mon, 12 Jan 2015 17:42:42 +0000, BartC wrote:

>> println int.bytes
>> println byte.bytes
>> println bit.bytes
>>
>> I get: 4, 1 and 1. But if I write:
>>
>> println int.bitwidth
>> println byte.bitwidth
>> println bit.bitwidth
>>
>> Then I get 32, 8 and 1.
>
> Which is evidently inconsistent with your definition of byte = 8 * bits.

Not with the last lot of bit-widths.

>> If you created a function in Ada to return the size of a type in terms
>> of 8-bit bytes, and the result had to be an integer, then you will get
>> similar problems.
>
> That would be Float (T'Size)/8.0 without rounding and (T'Size+7)/8 with
> rounding. Except that usefulness of such functions is questionable.
>
> When you write a custom storage pool in Ada, the compiler passes the
> required number of storage elements (note, not bits nor bytes) to your
> implementation of Allocate.
>
> 8 bits
> 1 byte
> 1 Storage_Element
>
> are potentially all different.

So? I can write this:

a := new(array, bit, -41..75)

This yields bounds of (-41,75), and a length of 117 /bits/. It is 
possible to work with bits, bit-fields and bit-arrays without worrying 
about bytes (although the byte size of that array if I was interested 
would be 15 bytes rather than 14.625).

So it's possible work with bits within software even though the 
underlying machine is byte-oriented, as most are. It's just not 
necessary to work exclusively with bits as you are suggesting.

And the same byte-oriented approach is used with memory and storage 
devices, even though the underlying hardware /is/ bit-oriented!

-- 
Bartc

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

64-bit bytes fir <profesor.fir@gmail.com> - 2015-01-05 01:38 -0800
  Re: 64-bit bytes robin.vowels@gmail.com - 2015-01-08 00:46 -0800
    Re: 64-bit bytes fir <profesor.fir@gmail.com> - 2015-01-08 00:53 -0800
      Re: 64-bit bytes robin.vowels@gmail.com - 2015-01-11 15:46 -0800
        Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-12 00:32 +0000
          Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 01:35 +0000
            Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-12 09:07 +0000
              Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 11:43 +0000
                Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-12 11:59 +0000
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 12:21 +0000
                Re: 64-bit bytes Mark Carroll <mtbc@bcs.org> - 2015-01-12 12:36 +0000
                Re: 64-bit bytes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-01-12 14:15 +0000
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 14:34 +0000
                Re: 64-bit bytes "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2015-01-12 16:35 +0100
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 17:42 +0000
                Re: 64-bit bytes "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2015-01-12 19:11 +0100
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 19:18 +0000
                Re: 64-bit bytes "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2015-01-12 21:34 +0100
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 22:01 +0000
                Re: 64-bit bytes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-01-13 00:51 +0000
                Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-12 13:18 +0000
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 14:16 +0000
                Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-12 14:48 +0000
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-12 15:05 +0000
                Re: 64-bit bytes Robert Wessel <robertwessel2@yahoo.com> - 2015-01-12 15:43 -0600
              Re: 64-bit bytes Kaz Kylheku <kaz@kylheku.com> - 2015-01-12 21:05 +0000
                Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-12 22:12 +0000
            Re: 64-bit bytes "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2015-01-12 10:12 +0100
          Re: 64-bit bytes robin.vowels@gmail.com - 2015-01-11 20:56 -0800
            Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-12 09:19 +0000
              Re: 64-bit bytes robin.vowels@gmail.com - 2015-01-12 06:22 -0800
                Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-12 14:51 +0000
                Re: 64-bit bytes robin.vowels@gmail.com - 2015-01-12 15:46 -0800
                Re: 64-bit bytes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-01-13 01:16 +0000
                Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-13 01:53 +0000
                Re: 64-bit bytes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-01-13 13:28 +0000
                Re: 64-bit bytes Richard Heathfield <invalid@see.sig.invalid> - 2015-01-13 13:57 +0000
                Re: 64-bit bytes "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2015-01-13 15:32 +0100
                Re: 64-bit bytes fir <profesor.fir@gmail.com> - 2015-01-13 06:33 -0800
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-13 16:41 +0000
                Re: 64-bit bytes fir <profesor.fir@gmail.com> - 2015-01-13 15:25 -0800
                Re: 64-bit bytes BartC <bc@freeuk.com> - 2015-01-13 23:49 +0000
                Re: 64-bit bytes fir <profesor.fir@gmail.com> - 2015-01-13 23:57 -0800

csiph-web