diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llmath/llmath.h | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/llmath/llmath.h')
-rw-r--r-- | linden/indra/llmath/llmath.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h index affdbf1..d3c0d86 100644 --- a/linden/indra/llmath/llmath.h +++ b/linden/indra/llmath/llmath.h | |||
@@ -440,4 +440,20 @@ inline F32 llsimple_angle(F32 angle) | |||
440 | return angle; | 440 | return angle; |
441 | } | 441 | } |
442 | 442 | ||
443 | //calculate the nearesr power of two number for val, bounded by max_power_two | ||
444 | inline U32 get_nearest_power_two(U32 val, U32 max_power_two) | ||
445 | { | ||
446 | if(!max_power_two) | ||
447 | { | ||
448 | max_power_two = 1 << 31 ; | ||
449 | } | ||
450 | if(max_power_two & (max_power_two - 1)) | ||
451 | { | ||
452 | return 0 ; | ||
453 | } | ||
454 | |||
455 | for(; val < max_power_two ; max_power_two >>= 1) ; | ||
456 | |||
457 | return max_power_two ; | ||
458 | } | ||
443 | #endif | 459 | #endif |