Blender  V2.93
BLI_math_bits.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
23 #include "BLI_math_inline.h"
24 #include "BLI_utildefines.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /* Search the value from LSB to MSB for a set bit. Returns index of this bit. */
31 MINLINE int bitscan_forward_i(int a);
32 MINLINE unsigned int bitscan_forward_uint(unsigned int a);
33 MINLINE unsigned int bitscan_forward_uint64(unsigned long long a);
34 
35 /* Similar to above, but also clears the bit. */
37 MINLINE unsigned int bitscan_forward_clear_uint(unsigned int *a);
38 
39 /* Search the value from MSB to LSB for a set bit. Returns index of this bit. */
40 MINLINE int bitscan_reverse_i(int a);
41 MINLINE unsigned int bitscan_reverse_uint(unsigned int a);
42 MINLINE unsigned int bitscan_reverse_uint64(unsigned long long a);
43 
44 /* Similar to above, but also clears the bit. */
46 MINLINE unsigned int bitscan_reverse_clear_uint(unsigned int *a);
47 
48 /* NOTE: Those functions returns 2 to the power of index of highest order bit. */
49 MINLINE unsigned int highest_order_bit_uint(unsigned int n);
50 MINLINE unsigned short highest_order_bit_s(unsigned short n);
51 
52 #ifdef __GNUC__
53 # define count_bits_i(i) __builtin_popcount(i)
54 #else
55 MINLINE int count_bits_i(unsigned int n);
56 #endif
57 
58 MINLINE int float_as_int(float f);
59 MINLINE unsigned int float_as_uint(float f);
60 MINLINE float int_as_float(int i);
61 MINLINE float uint_as_float(unsigned int i);
62 MINLINE float xor_fl(float x, int y);
63 
64 #if BLI_MATH_DO_INLINE
65 # include "intern/math_bits_inline.c"
66 #endif
67 
68 #ifdef __cplusplus
69 }
70 #endif
MINLINE int float_as_int(float f)
MINLINE unsigned int bitscan_forward_uint(unsigned int a)
MINLINE int bitscan_forward_clear_i(int *a)
MINLINE float xor_fl(float x, int y)
MINLINE unsigned int bitscan_forward_clear_uint(unsigned int *a)
MINLINE float int_as_float(int i)
MINLINE unsigned int float_as_uint(float f)
MINLINE unsigned int bitscan_reverse_uint(unsigned int a)
MINLINE int bitscan_reverse_clear_i(int *a)
MINLINE unsigned short highest_order_bit_s(unsigned short n)
MINLINE float uint_as_float(unsigned int i)
MINLINE int bitscan_forward_i(int a)
MINLINE int count_bits_i(unsigned int n)
MINLINE unsigned int bitscan_forward_uint64(unsigned long long a)
MINLINE unsigned int bitscan_reverse_clear_uint(unsigned int *a)
MINLINE unsigned int highest_order_bit_uint(unsigned int n)
MINLINE int bitscan_reverse_i(int a)
MINLINE unsigned int bitscan_reverse_uint64(unsigned long long a)
#define MINLINE
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
static unsigned a[3]
Definition: RandGen.cpp:92