~mir-team/mir/in-process-egl+input-conglomeration

« back to all changes in this revision

Viewing changes to 3rd_party/glm/glm/gtx/optimum_pow.inl

Merged trunk and fixed issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
///////////////////////////////////////////////////////////////////////////////////////////////////
2
 
// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
3
 
///////////////////////////////////////////////////////////////////////////////////////////////////
4
 
// Created : 2005-12-21
5
 
// Updated : 2005-12-27
6
 
// Licence : This source is under MIT License
7
 
// File    : glm/gtx/optimum_pow.inl
8
 
///////////////////////////////////////////////////////////////////////////////////////////////////
9
 
 
10
 
namespace glm
11
 
{
12
 
        template <typename genType> 
13
 
        GLM_FUNC_QUALIFIER genType pow2(const genType& x)
14
 
        {
15
 
                return x * x;
16
 
        }
17
 
 
18
 
        template <typename genType> 
19
 
        GLM_FUNC_QUALIFIER genType pow3(const genType& x)
20
 
        {
21
 
                return x * x * x;
22
 
        }
23
 
 
24
 
        template <typename genType> 
25
 
        GLM_FUNC_QUALIFIER genType pow4(const genType& x)
26
 
        {
27
 
                return x * x * x * x;
28
 
        }
29
 
 
30
 
        GLM_FUNC_QUALIFIER bool powOfTwo(int x)
31
 
        {
32
 
                return !(x & (x - 1));
33
 
        }
34
 
 
35
 
        GLM_FUNC_QUALIFIER detail::tvec2<bool> powOfTwo(const detail::tvec2<int>& x)
36
 
        {
37
 
                return detail::tvec2<bool>(
38
 
                        powOfTwo(x.x),
39
 
                        powOfTwo(x.y));
40
 
        }
41
 
 
42
 
        GLM_FUNC_QUALIFIER detail::tvec3<bool> powOfTwo(const detail::tvec3<int>& x)
43
 
        {
44
 
                return detail::tvec3<bool>(
45
 
                        powOfTwo(x.x),
46
 
                        powOfTwo(x.y),
47
 
                        powOfTwo(x.z));
48
 
        }
49
 
 
50
 
        GLM_FUNC_QUALIFIER detail::tvec4<bool> powOfTwo(const detail::tvec4<int>& x)
51
 
        {
52
 
                return detail::tvec4<bool>(
53
 
                        powOfTwo(x.x),
54
 
                        powOfTwo(x.y),
55
 
                        powOfTwo(x.z),
56
 
                        powOfTwo(x.w));
57
 
        }
58
 
}//namespace glm