FaceGen 3 SDKs Reference
Loading...
Searching...
No Matches
LibFg3Main
algs.cpp
1
//
2
// Copyright (c) Singular Inversions Inc. 1999.
3
//
4
// Authors: Andrew Beatty
5
// Created: Nov 5, 1999.
6
//
7
8
#include "stdafx.h"
9
10
#include "algs.hpp"
11
#include "FgSerial.hpp"
12
13
using namespace
std;
14
15
namespace
Fg {
16
17
uint
18
fr2Log2Floor(uint a)
19
{
20
FGASSERT(a > 0);
// Minus infinity we don't do here...
21
uint b=0;
22
do
23
{
24
a = a >> 1;
// Shift right one bit, high bit 0 filled for
25
b++;
// non-negative numbers.
26
}
while
(a > 0);
27
28
return
(b-1);
29
}
30
31
uint
32
fr2Log2Ceil(uint a)
33
{
34
if
(a == fr2Pow2Floor(a))
35
return
fr2Log2Floor(a);
36
else
37
return
(fr2Log2Floor(a) + 1);
38
}
39
40
}
Generated on Fri Nov 8 2024 08:25:14 for FaceGen 3 SDKs Reference by
1.9.7