Blender  V3.3
BLI_math_bits.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
9 #include "BLI_math_inline.h"
10 #include "BLI_utildefines.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /* Search the value from LSB to MSB for a set bit. Returns index of this bit. */
17 
18 MINLINE int bitscan_forward_i(int a);
19 MINLINE unsigned int bitscan_forward_uint(unsigned int a);
20 MINLINE unsigned int bitscan_forward_uint64(unsigned long long a);
21 
22 /* Similar to above, but also clears the bit. */
23 
25 MINLINE unsigned int bitscan_forward_clear_uint(unsigned int *a);
26 
27 /* Search the value from MSB to LSB for a set bit. Returns index of this bit. */
28 
29 MINLINE int bitscan_reverse_i(int a);
30 MINLINE unsigned int bitscan_reverse_uint(unsigned int a);
31 MINLINE unsigned int bitscan_reverse_uint64(unsigned long long a);
32 
33 /* Similar to above, but also clears the bit. */
34 
36 MINLINE unsigned int bitscan_reverse_clear_uint(unsigned int *a);
37 
38 /* NOTE: Those functions returns 2 to the power of index of highest order bit. */
39 
40 MINLINE unsigned int highest_order_bit_uint(unsigned int n);
41 MINLINE unsigned short highest_order_bit_s(unsigned short n);
42 
43 #ifdef __GNUC__
44 # define count_bits_i(i) __builtin_popcount(i)
45 #else
46 MINLINE int count_bits_i(unsigned int n);
47 #endif
48 
49 MINLINE int float_as_int(float f);
50 MINLINE unsigned int float_as_uint(float f);
51 MINLINE float int_as_float(int i);
52 MINLINE float uint_as_float(unsigned int i);
53 MINLINE float xor_fl(float x, int y);
54 
55 #if BLI_MATH_DO_INLINE
56 # include "intern/math_bits_inline.c"
57 #endif
58 
59 #ifdef __cplusplus
60 }
61 #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:78