Hi, Sicong. The proposition you made before are not really a good solution, since you force the compiler to use the double version of the log function, which might be slow.
For the integer version of the log2, I have another
proposition. I have attached a newly patched file. The
integer log2 function does compute the binary
logarithm based on the bit structure of the number.
The method seems to be faster than a double
computation of log2.
Robert, please check out if you are agree with this
version.
Sicong, please check out if it is now working for your
system. Actually it should now.
Cheers, Art
P.S. There exists some nice methods to compute binary
logarithm really fast, but they relly on certain CPU
instructions. This function does provide a generic
solution, which might not as fast, but still fast
enough ;-)
--- sicong he <[EMAIL PROTECTED]> schrieb:
> It should be the bad VS2005 problem~~~~
>
> 2007/9/11, sicong he <[EMAIL PROTECTED]>:
> >
> > My VS2005 report me:
> >
> > Compiler Error C2668. 'log' : ambiguous call to
> overloaded function.
> >
> > I see in VS2005, function log have only works with
> double or float:
> > double __cdecl log(__in double _X);
> > So you should convert "int" to "double":
> > inline int log2(int v) { return
> static_cast<float>(floorf(log((double)v) *
> > INVLN_2)); }
> > But same problem happened to "floor" function. In
> VS2005 floor function
> > works with double or float, so log2 should return
> a float or double:
> > inline float log2(int v) { return
> static_cast<float>(floorf(log((double)v)
> > * INVLN_2)); }
> >
> > And this new log2 function fix the build problem.
> >
> >
> >
> >
> > 2007/9/11, Art Tevs <[EMAIL PROTECTED]>:
> >
> > > yes, it seems that math.h does not define the
> log2
> > > function on some systems.
> > >
> > > Sorry, for this.
> > >
> > > My proposition is to patch the osg's Math file
> to
> > > support for log2 method. I attached the patched
> file,
> > > which contains log2 function.
> > >
> > > Best regards, Art
> > >
> > >
> > >
> > > --- sicong he < [EMAIL PROTECTED]> schrieb:
> > >
> > > > It seems that VS2005 c++ library do not have
> log2()
> > > > function defined. So I
> > > > change log2() function to log()/log(2.0), I
> don't
> > > > know if it is slower than
> > > > log2() but it really works.
> > > >
> > > > 2007/9/11, sicong he <[EMAIL PROTECTED]>:
> > > > >
> > > > > I fixed this by change all log2(x) to:
> > > > > log((double)maximum(...))/log( 2.0)
> > > > > Then I successfully built under VS2005.
> > > > > Attachment is my patch for this problem.
> Please
> > > > test it.
> > > > >
> > > > > 2007/9/11, Shue, John <
> [EMAIL PROTECTED]>:
> > > > > >
> > > > > > I'm getting same compiler error on
> FreeBSD:
> > > > > > Texture1D.cpp:417: error: `log2' was not
> > > > declared in this scope
> > > > > >
> > > > > > I did:
> > > > > > # svn update
> > > > > > # ./configure
> > > > > > # make
> > > > > >
> > > > > > -john
> > > > > >
> > > > > > ------------------------------
> > > > > > *From:*
> > > > [EMAIL PROTECTED]
> [mailto:
> > > > > >
> [EMAIL PROTECTED] *On
> > > > Behalf Of *sicong he
> > > > > > *Sent:* Tuesday, September 11, 2007 10:21
> AM
> > > > > > *To:* Public OpenSceneGraph Users
> discussion
> > > > list.
> > > > > > *Subject:* Re: [osg-users] Please test SVN
> > > > version of OpenSceneGraph
> > > > > >
> > > > > >
> > > > > > I get latest version and build under
> VS2005.
> > > > > > But in these line:
> > > > > > TextureRectangle.cpp Line 561,
> > > > TextureCubeMap.cpp Line 387,
> > > > > > Texture3D.cpp Line 459, Texture2DArray.cpp
> Line
> > > > 467, Texture2D.cpp Line
> > > > > > 411,
> > > > > > Texture1D.cpp Line 417
> > > > > > These lines VS2005 reports:
> > > > > > error C3861: "log2" can't find symbol
> > > > > > Is there some header lost?
> > > > > >
> > > > > >
> > > > > >
> > > > > > 2007/9/11, Robert Osfield
> > > > <[EMAIL PROTECTED]>:
> > > > > > >
> > > > > > > Hi All,
> > > > > > >
> > > > > > > I have merged quite a few changes to the
> OSG
> > > > over the last few days,
> > > > > > > these could break the build, so I'd like
> some
> > > > feedback on how the OSG
> > > > > > > is build and running on various
> platforms
> > > > before I go ahead the weekly
> > > > > > > dev release (2.1.10).
> > > > > > >
> > > > > > > Thanks in advance,
> > > > > > > Robert.
> > > > > > >
> > > >
> _______________________________________________
> > > > > > > osg-users mailing list
> > > > > > > [email protected]
> > > > > > >
> > > >
> > >
> > >
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > This communication, along with any
> attachments,
> > > > is covered by federal and state law governing
> > > > electronic communications and may contain
> company
> > > > proprietary and legally privileged
> information.
> > > > > > If the reader of this message is not the
> > > > intended recipient, you are hereby notified
> that any
> > > > dissemination, distribution, use or copying of
> this
> > > > message is strictly prohibited.
> > > > > > If you have received this in error, please
> reply
> > > > immediately to the sender and delete this
> message.
> > > > Thank you.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> _______________________________________________
> > > > > > osg-users mailing list
> > > > > > [email protected]
> > > > > >
> > > >
> > >
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> _______________________________________________
> > > > osg-users mailing list
> > > > [email protected]
> > > >
> > >
> > >
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > >
> > >
> > >
> > >
> > > Heute schon einen Blick in die Zukunft von
> E-Mails wagen? Versuchen
> > > Sie´s mit dem neuen Yahoo! Mail.
> www.yahoo.de/mail
> > > _______________________________________________
> > > osg-users mailing list
> > > [email protected]
> > >
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >
>
=== message truncated ===>
_______________________________________________
> osg-users mailing list
> [email protected]
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
Die etwas anderen Infos rund um das Thema Reisen. BE A BETTER
WELTENBUMMLER! www.yahoo.de/clever
Math
Description: 2923311751-Math
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

