This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: how to make a long long
On Saturday 22 February 2003 22:34, you wrote:
> Sebastian Huber <sebastian-huber at web dot de> writes:
> > Adrian Sandor <aditsu at yahoo dot com> schrieb am 22.02.03 16:44:50:
> > > > what is wrong with
> > > >
> > > > unsigned long long i = ((0x0ULL | uint32high) << 32)
> > > >
> > > > | uint32low;
> > > >
> > > > ?
> > >
> > > this approach uses an OR between an unsigned long long
>
> OR often has the lowest latency and highest paralellism a cpu can
> offer. It is much simpler than, for example, add or increment.
>
> > > and an unsigned int, a SHIFT-LEFT on an unsigned long
> > > long and another OR between 2 an unsigned long long
> > > and an unsigned int;
> > > I think these are too heavy calculations just for
> > > putting 2 unsigned ints next to each other
>
> I doubt it. There have been a few microcontrollers for whom SHIFT-LEFT
> was/is expensive, but they are a minority.
>
> > C is not an assembly language. It's up to the compiler to generate
> > optimized code.
>
> If you actually need optimized code, the programmer has to write it,
> regardless of the language. The compiler merely allows one to
> concentrate on the code that needs optimization most.
You should interpret my statement in view of this special problem. If you want
to play with bits in plain C your tools are limited.