Created
December 1, 2014 23:13
-
-
Save arthurwolf/ba9e2adae88e9c79ee6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Called a great many times per second, to step if we have to now | |
inline void tick() { | |
// increase the ( fixed point ) counter by one tick 11t | |
fx_counter += (uint32_t)(1<<16); | |
// if we are to step now 10t | |
if (fx_counter >= fx_ticks_per_step) | |
step(); | |
}; | |
} | |
becomes | |
// Called a great many times per second, to step if we have to now | |
inline void tick() { | |
// increase the ( fixed point ) counter by one tick 11t | |
fx_counter += fx_steps_per_tick | |
// if we are to step now 10t | |
if (fx_counter >= 2^32 or whatever) | |
step(); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tick(){
counter += 1
if( counter >= target ){
do a step
counter -= target
}
}
becomes :
tick(){
counter += increment
if( counter >= 1 ){
do a step
counter -= 1
}
}