lkml.org 
[lkml]   [2000]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: __ucmpdi2
On Sep 19,  1:08pm, Matti Aarnio wrote:
>
> On Tue, Sep 19, 2000 at 02:58:01AM -0700, Jeremy Higdon wrote:
> > Hello,
> >
> > I'm using a 64 bit variable in a switch statement. Gcc is generating code
> > which make calls to __ucmpdi2, a function defined in libgcc. I figured
> > out that it was the switch statement from examining the generated code.
> >
> > The question is whether I should change C code to avoid constructions
> > which make calls to this routine (a little hard to determine a priori)
> > or if there is an appropriate way to add this to the kernel.
>
> Yes do change it.
>
> Is the value-space for the case's a LONG LONG, or
> mere set of INTs or LONGs ?

As it turns out, the values do fit into a 32 bit space, since they are
a result of shifts and truncates. Perhaps a simple cast in the switch
statement is all I need.

> Can you simply (and reliably) cast the variable
> into e.g. 'long' ? Or should you use if / else if / ..
> chains ?

I think either will work.

Is there a little FAQ of C constructions you should not use if you
are writing kernel code? It took a little doing to figure out that
it was the switch that was causing trouble and not the shifts and
arithmetic operations, and I'd like to avoid that in the future :-).

> /Matti Aarnio
>
>-- End of excerpt from Matti Aarnio

thanks

jeremy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.206 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site