John Matthews wrote: > --- In [email protected], Thomas Hruska <[EMAIL PROTECTED]> wrote: >> One of the things I really dislike about the ANSI C/C++ Standard is > that >> there is no way to define your own data types in bits. You could use a >> struct bitfield but you are still limited to the maximum int size for >> the compiler (e.g. you can't simply declare a 1726-bit integer). > > I don't know about C++, but perhaps that wouldn't really fit into the > low-ish level nature of C?
Exactly why such a feature should exist. The compiler can handle allocating 'x' bytes along integer boundaries and then generate optimized assembler for the instructions than can be done in the higher-level language. Although, it probably makes more sense to declare on even byte-boundaries and multiples of two (e.g. 1024-bit, 2048-bit) than some random number of bits (e.g. 1726-bit). We've sort of been heading along that route anyway (i.e. 8-bit, 16-bit, 32-bit, and now 64-bit architectures). While we are on the subject of wishing for things in the Standard, 'ror' and 'rol' operators should exist too. They can be faked using shift operators but I've never seen a compiler optimize the two shift instructions down to a ror/rol. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
