Show Posts
|
|
Pages: [1]
|
|
3
|
Game Development / Shared Code / Re: Fastest get2fold algorithm
|
on: 2006-03-22 02:29:16
|
|
Interesting that you say this is the fastest algorithm, which it is not. While it may be in the general case when one uses it in a certain context knowing the upper and lower bounds then a lookup table will be the fatest method (3-4x faster than BS) :-)
i.e.
static final int[] lookupTable; static { lookupTable = new int[MAX_LOOKUP]; for(int i = 0; i < MAX_LOOKUP; i++) lookupTable = get2FoldUnrolled(i); } public final static int get2FoldLookup(int val) { return lookupTable[val]; } Your application will probably hit a certain input range 90% of the time, in which case you use the lookup table method. For all other input values you use the BS method.
Its always a space/time tradeoff.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|