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


Groups > comp.programming > #5123

Re: 64-bit bytes

From BartC <bc@freeuk.com>
Newsgroups comp.programming
Subject Re: 64-bit bytes
References (13 earlier) <1wjz2viojajea.1kr9ibzhhn9v7.dlg@40tude.net> <oITsw.567851$812.424728@fx20.am4> <1tskc5x9tqkm7$.13yuk96hv2vjx$.dlg@40tude.net> <F6Vsw.755958$MH.21930@fx12.am4> <jhhz4ipyuhdl$.v6d0ijiad4zb.dlg@40tude.net>
Message-ID <JuXsw.678929$N92.285713@fx31.am4> (permalink)
Organization virginmedia.com
Date 2015-01-12 22:01 +0000

Show all headers | View raw


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

>>>> println bit.bytes
>>>>
>>>> I get: 4, 1 and 1. But if I write:

>>> Which is evidently inconsistent with your definition of byte = 8 * bits.
>>
>> Not with the last lot of bit-widths.
>
> Of course it is:
>
> int.bytes = 4 & int.bitwidth = 32 => byte = 32/4 = 8 bits
> bit.bytes = 1 & bit.bitwidth = 1 => byte = 1/1 = 1 bit
>
> Either your program lies or else X.bytes and X.bits measure different
> things. "bit" left of ".bytes" is not like "bit" left of ".bitwidth" q.e.d.

I explained my rationale for returning the byte-size of a single bit as 
1 rather than 0 or anything else.

But, one advantage of having your own language is that things can be 
changed rapidly (it helps that I've never yet used the feature anywhere):

println bit.bytes

now displays 0.125. And the calculations are consistent.

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

> And the bitwidth of 15 bytes is 117? See, byte is not 8 bits again!

It's now 14.625.

Of course the number of bits in a byte does not depend on exactly how my 
language works. It was 8 yesterday and it is still 8 today.

> It is absolutely necessary as you just have explained: the logical width of
> the array is 117 bits, its storage representation width is 15 storage
> elements.

It actually uses 16 bytes, for reasons the programmer doesn't need to 
now (32 to get more technical). But to copy all the bit data will 
require a minimum of 15 whole bytes. Now however he will need to round 
up the number of bytes. (Actually, now I've made my point, I might 
change it back again...)

-- 
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