It is currently Wed Dec 11, 2019 3:41 am


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [Closed] Shift on native integer type, can overflow if...
PostPosted: Sun Mar 04, 2012 1:49 am 

Joined: Wed Apr 27, 2011 7:10 am
Posts: 43
https://gitorious.org/polyvox/polyvox/b ... r.h#line79

Code:
                static DensityType getThreshold() throw() {return  0x01 << (NoOfDensityBits - 1);}


It should probably be:

Code:
                static DensityType getThreshold() throw() {return  DensityType(0x01) << (NoOfDensityBits - 1);}


Similar examples should probably be fixed as well. If a unit test is made, it should try a few different types including some larger (64 bit) types.

_________________
irc://irc.freenode.net/#polyvox


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Shift on native integer type, can overflow if wrong type
PostPosted: Sun Mar 04, 2012 8:00 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
You're probably right, but these functions are actually removed in the Git version of PolyVox. Deciding whether a voxel is above/below a threshold will be performed via some kind of callback so that the primitive types (including floats, where the shifting makes no sense) can be used as well as the predefined voxel types.

Details are in this thread: viewtopic.php?p=2711#p2711

Thanks anyway!


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net