Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #86894 > unrolled thread
| Started by | Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> |
|---|---|
| First post | 2022-10-12 15:57 -0700 |
| Last post | 2022-10-15 11:34 +0200 |
| Articles | 6 on this page of 106 — 22 participants |
Back to article view | Back to comp.lang.c++
CHAR_BIT is not eight Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-12 15:57 -0700
Re: CHAR_BIT is not eight "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-12 16:01 -0700
Re: CHAR_BIT is not eight Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-10-12 17:16 -0700
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-13 11:38 +0200
Re: CHAR_BIT is not eight Michael S <already5chosen@yahoo.com> - 2022-11-16 06:24 -0800
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-11-17 11:04 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-11-17 16:40 +0000
Re: CHAR_BIT is not eight Richard Damon <Richard@Damon-Family.org> - 2022-11-17 23:23 -0500
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-11-18 08:16 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-11-18 16:33 +0000
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-11-18 18:54 +0100
Re: CHAR_BIT is not eight Michael S <already5chosen@yahoo.com> - 2022-11-18 03:47 -0800
Re: CHAR_BIT is not eight scott@slp53.sl.home (Scott Lurndal) - 2022-11-18 14:52 +0000
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-11-18 16:32 +0000
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-11-18 19:05 +0100
Re: CHAR_BIT is not eight scott@slp53.sl.home (Scott Lurndal) - 2022-11-18 18:16 +0000
Re: CHAR_BIT is not eight Juha Nieminen <nospam@thanks.invalid> - 2022-10-13 08:02 +0000
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-13 08:08 +0000
Re: CHAR_BIT is not eight Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-15 11:35 +0200
Re: CHAR_BIT is not eight Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-15 02:53 -0700
Re: CHAR_BIT is not eight Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-15 11:57 +0200
Re: CHAR_BIT is not eight Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-15 03:05 -0700
Re: CHAR_BIT is not eight Juha Nieminen <nospam@thanks.invalid> - 2022-10-17 06:18 +0000
Re: CHAR_BIT is not eight Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-17 15:29 -0500
Re: CHAR_BIT is not eight Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-13 02:06 -0700
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-13 11:42 +0200
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-13 15:36 +0000
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-13 23:06 +0200
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-13 22:30 +0100
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-14 15:27 +0200
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-14 14:47 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-14 14:58 +0000
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-14 21:01 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-15 10:28 +0000
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-15 13:39 +0200
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-15 12:45 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-15 15:18 +0000
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-15 16:24 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-15 15:34 +0000
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-15 16:39 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-15 15:53 +0000
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-15 16:55 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-15 15:57 +0000
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-15 16:59 +0100
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-17 15:27 +0000
Re: CHAR_BIT is not eight "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-10-17 09:04 -0700
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-17 16:13 +0000
Re: CHAR_BIT is not eight red floyd <no.spam.here@its.invalid> - 2022-10-17 09:44 -0700
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-17 17:47 +0100
Re: CHAR_BIT is not eight Manfred <noname@add.invalid> - 2022-10-18 01:10 +0200
Re: CHAR_BIT is not eight "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-17 16:22 -0700
Re: CHAR_BIT is not eight Paul N <gw7rib@aol.com> - 2022-10-18 05:13 -0700
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-18 15:04 +0000
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-18 17:40 +0100
Re: CHAR_BIT is not eight "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-10-18 12:14 -0700
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-19 15:12 +0000
Re: CHAR_BIT is not eight scott@slp53.sl.home (Scott Lurndal) - 2022-10-19 15:35 +0000
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-20 16:16 +0000
Re: CHAR_BIT is not eight Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-15 20:13 +0200
Re: CHAR_BIT is not eight Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-15 20:11 +0200
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-15 20:03 +0100
Re: CHAR_BIT is not eight Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-16 07:51 +0200
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-16 17:03 +0200
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-16 16:34 +0100
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-16 18:51 +0200
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-16 18:11 +0100
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-16 19:18 +0100
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-16 22:02 +0200
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-16 21:19 +0100
Re: CHAR_BIT is not eight scott@slp53.sl.home (Scott Lurndal) - 2022-10-16 21:24 +0000
Re: CHAR_BIT is not eight "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-16 14:38 -0700
Re: CHAR_BIT is not eight "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-16 14:48 -0700
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-16 22:39 +0100
Re: CHAR_BIT is not eight scott@slp53.sl.home (Scott Lurndal) - 2022-10-16 23:49 +0000
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-17 09:54 +0200
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-17 17:31 +0100
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-17 19:56 +0200
Re: CHAR_BIT is not eight Muttley@dastardlyhq.com - 2022-10-17 15:29 +0000
Re: CHAR_BIT is not eight Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-17 17:33 +0100
Re: CHAR_BIT is not eight Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-15 11:55 -0700
Re: CHAR_BIT is not eight "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-15 13:06 -0700
Re: CHAR_BIT is not eight Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-15 15:42 -0700
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-16 19:10 +0200
Re: CHAR_BIT is not eight Vir Campestris <vir.campestris@invalid.invalid> - 2022-10-16 21:28 +0100
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-17 10:09 +0200
Re: CHAR_BIT is not eight "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-16 13:35 -0700
Re: CHAR_BIT is not eight "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-16 13:36 -0700
Re: CHAR_BIT is not eight Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-11-02 17:46 -0700
Re: CHAR_BIT is not eight Bo Persson <bo@bo-persson.se> - 2022-10-13 11:10 +0200
Re: CHAR_BIT is not eight Juha Nieminen <nospam@thanks.invalid> - 2022-10-13 10:49 +0000
Re: CHAR_BIT is not eight Juha Nieminen <nospam@thanks.invalid> - 2022-10-13 12:05 +0000
Re: CHAR_BIT is not eight Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-13 06:34 -0700
Re: CHAR_BIT is not eight Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-10-13 15:24 +0100
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-13 15:59 +0200
Re: CHAR_BIT is not eight Juha Nieminen <nospam@thanks.invalid> - 2022-10-14 05:54 +0000
Re: CHAR_BIT is not eight Paavo Helde <eesnimi@osa.pri.ee> - 2022-10-14 09:16 +0300
Re: CHAR_BIT is not eight Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-11-16 05:41 -0800
Re: CHAR_BIT is not eight Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-11-16 10:38 -0800
Re: CHAR_BIT is not eight Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-05 11:42 -0800
Re: CHAR_BIT is not eight Öö Tiib <ootiib@hot.ee> - 2022-12-06 01:03 -0800
Re: CHAR_BIT is not eight Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-28 20:49 -0800
Re: CHAR_BIT is not eight Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-14 00:17 -0700
Re: CHAR_BIT is not eight David Brown <david.brown@hesbynett.no> - 2022-10-14 15:33 +0200
Re: CHAR_BIT is not eight Vir Campestris <vir.campestris@invalid.invalid> - 2022-10-16 21:37 +0100
Re: CHAR_BIT is not eight Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-17 15:24 -0500
Re: CHAR_BIT is not eight Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-15 11:34 +0200
Page 6 of 6 — ← Prev page 1 2 3 4 5 [6]
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Date | 2022-12-28 20:49 -0800 |
| Message-ID | <86358yvmoy.fsf@linuxsc.com> |
| In reply to | #87705 |
Tiib <ootiib@hot.ee> writes: > On Monday, 5 December 2022 at 21:43:08 UTC+2, Tim Rentsch wrote: > >> Testing can be used to show the presence of bugs, but never their >> absence. The same principle applies to determining whether code >> is platform agnostic. Showing that part of a program is platform >> agnostic can be done using formal methods and formal semantics, >> just like other kinds of formal verification. It can be more >> work to take into account the range of variation allowed by >> platform variability, but the principles involved are the same. > > Formal proof of complex system is usually impossible as general > solution is missing even to simple system of three point > masses (three body problem). All platforms are way more complex > than that ... yet made by fallible entities under time-to-market > pressure. >> [.. commenting on the level of hyperbole in the statement "Software >> without tests is just a work of literature." ..] > > That hyperbole seems to be in our laws. All jurisdictions that I know > of address copyrights of software as those of works of literature. > So software that has not been tested to be useful for something > is on general case just a work of literature written by author of it. You are either remarkably clueless or you do a very convincing imitation of being remarkably clueless.
[toc] | [prev] | [next] | [standalone]
| From | Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> |
|---|---|
| Date | 2022-10-14 00:17 -0700 |
| Message-ID | <2ddfda67-abef-4e79-909e-987839535c0dn@googlegroups.com> |
| In reply to | #86947 |
On Friday, October 14, 2022 at 6:54:49 AM UTC+1, Juha Nieminen wrote:
> For example if you are writing, say, a small library that calculates
> hashes or checksums using a particular algorithm. It's not at all
> unrealistic that such a library could have uses in these more exotic
> microcontrollers (as microcontrollers are often used in embedded
> systems that handle data somehow, and might be interested in calculating
> things like checksums and hashes). And it is quite likely that such
> an algorithm might care about bit sizes.
I have the code for an encryption algorithm here, which I got off Github. The code is a single C++ header file that's supposed to be fully-portable. I want to take this header file and add it to my own 'universal header file' which will be used on microcontrollers and desktop PC's. I've looked through the encryption header file, and I see that they use "unsigned short" for anything up to 65 thousand, and then "unsigned long" for anything up to 4 billion, so that's fine. There are however a few lines I have to tweak, such as the following:
p[i] = p[i - 1] << 4u;
I need to make that:
p[i] = (p[i-1] << 4u) & 0xF0;
To be honest, discovering a computer-and-compiler-combo with a CHAR_BIT != 8 like this is quite an experience for me. It's like I'm a biologist who's been dealing with carbon-based life forms all his life, and they've flown me in a silicon-based life form from Mars and I have it under my microscope. Twenty years is a long time to have CHAR_BIT invariably equal to 8.
I'm re-writing the encryption code so that it deals in 32-Bit chunks, and I'm using 'uint_least32_t' for that purpose just in case there isn't a 32-Bit type.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2022-10-14 15:33 +0200 |
| Message-ID | <tiboff$24iak$1@dont-email.me> |
| In reply to | #86949 |
On 14/10/2022 09:17, Frederick Virchanza Gotham wrote: > On Friday, October 14, 2022 at 6:54:49 AM UTC+1, Juha Nieminen wrote: > >> For example if you are writing, say, a small library that calculates >> hashes or checksums using a particular algorithm. It's not at all >> unrealistic that such a library could have uses in these more exotic >> microcontrollers (as microcontrollers are often used in embedded >> systems that handle data somehow, and might be interested in calculating >> things like checksums and hashes). And it is quite likely that such >> an algorithm might care about bit sizes. > > > I have the code for an encryption algorithm here, which I got off Github. You'll want to check that code anyway. There's a lot of excellent code on Github, but there's also a lot of rubbish or questionable code masquerading as good code. If reliable encryption is important, you have to be very careful - remember that testing can only show the presence of bugs, not their absence. > The code is a single C++ header file that's supposed to be fully-portable. I want to take this header file and add it to my own 'universal header file' which will be used on microcontrollers and desktop PC's. I've looked through the encryption header file, and I see that they use "unsigned short" for anything up to 65 thousand, and then "unsigned long" for anything up to 4 billion, so that's fine. There are however a few lines I have to tweak, such as the following: > > p[i] = p[i - 1] << 4u; > > I need to make that: > > p[i] = (p[i-1] << 4u) & 0xF0; > > To be honest, discovering a computer-and-compiler-combo with a CHAR_BIT != 8 like this is quite an experience for me. It's like I'm a biologist who's been dealing with carbon-based life forms all his life, and they've flown me in a silicon-based life form from Mars and I have it under my microscope. Twenty years is a long time to have CHAR_BIT invariably equal to 8. > > I'm re-writing the encryption code so that it deals in 32-Bit chunks, and I'm using 'uint_least32_t' for that purpose just in case there isn't a 32-Bit type. If the code works fine even if "uint_least32_t" is not 32-bit, then perhaps "uint_fast32_t" would be better - even though it is 64-bit on some systems. (And if it won't be correct on such systems, then you need uint32_t anyway.)
[toc] | [prev] | [next] | [standalone]
| From | Vir Campestris <vir.campestris@invalid.invalid> |
|---|---|
| Date | 2022-10-16 21:37 +0100 |
| Message-ID | <tihq2t$37j3o$3@dont-email.me> |
| In reply to | #86949 |
On 14/10/2022 08:17, Frederick Virchanza Gotham wrote: > To be honest, discovering a computer-and-compiler-combo with a CHAR_BIT != 8 like this is quite an experience for me. It's like I'm a biologist who's been dealing with carbon-based life forms all his life, and they've flown me in a silicon-based life form from Mars and I have it under my microscope. Twenty years is a long time to have CHAR_BIT invariably equal to 8. Pfft kids these days.... The first and third architectures I ever used had 6 bit chars (DECSystem10 and ICL 1900). Luckily I never had to use C on them :) Andy
[toc] | [prev] | [next] | [standalone]
| From | Lynn McGuire <lynnmcguire5@gmail.com> |
|---|---|
| Date | 2022-10-17 15:24 -0500 |
| Message-ID | <tikdm8$3h56e$1@dont-email.me> |
| In reply to | #87030 |
On 10/16/2022 3:37 PM, Vir Campestris wrote: > On 14/10/2022 08:17, Frederick Virchanza Gotham wrote: >> To be honest, discovering a computer-and-compiler-combo with a >> CHAR_BIT != 8 like this is quite an experience for me. It's like I'm a >> biologist who's been dealing with carbon-based life forms all his >> life, and they've flown me in a silicon-based life form from Mars and >> I have it under my microscope. Twenty years is a long time to have >> CHAR_BIT invariably equal to 8. > > Pfft kids these days.... > > The first and third architectures I ever used had 6 bit chars > (DECSystem10 and ICL 1900). Luckily I never had to use C on them :) > > Andy Yup, I used six bit bytes, 6 byte words (36 bits), on Univac 1108s. We also had six bit bytes with 10 byte words (60 bits), on CDC 7600s. Big beautiful iron. Unfortunately, we had to abandon the Univac 1108 in 1982 when our code and data exceeded 2 MB on that platform. We bought a 32 bit Prime 450 in 1977, upgraded to a Prime 750 in 1980, and a Prime 2250 in 1983 ??? We ported to a customer's Vax VMS box in 1985 ??? All Fortran platforms. Lynn
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2022-10-15 11:34 +0200 |
| Message-ID | <tiduqu$2l925$1@dont-email.me> |
| In reply to | #86894 |
Am 13.10.2022 um 00:57 schrieb Frederick Virchanza Gotham: > Since I started programming in C/C++ back in the early 2000's, I never encountered a compiler with CHAR_BIT anything other than 8. > > Well just now in the past 15 minutes, I was trying to get the code for the 'base58' algorithm to compile for the Texas Instruments F2809 microcontroller using the 'cl2000' compiler. When you write for an architecutre that is so exoic you usually don't need portable code. When you write for non-exotic architectures you usually don't need portability to such exotic architectures. So you usually don't need to care for CHAR_BIT. I've stopped using CHAR_BIT for that and I simply write * 8 if i need the number of bits; I think that's more readable.
[toc] | [prev] | [standalone]
Page 6 of 6 — ← Prev page 1 2 3 4 5 [6]
Back to top | Article view | comp.lang.c++
csiph-web