Volumes Of Fun http://www.volumesoffun.com/phpBB3/ |
|
[Closed] Shift on native integer type, can overflow if... http://www.volumesoffun.com/phpBB3/viewtopic.php?f=15&t=340 |
Page 1 of 1 |
Author: | realazthat [ Sun Mar 04, 2012 1:49 am ] |
Post subject: | [Closed] Shift on native integer type, can overflow if... |
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. |
Author: | David Williams [ Sun Mar 04, 2012 8:00 am ] |
Post subject: | Re: Shift on native integer type, can overflow if wrong type |
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! |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |