FastUIDraw
fastuidraw_bit_utils.glsl.hpp
Go to the documentation of this file.
1 /*!
2  * \file fastuidraw_bit_utils.glsl.hpp
3  * \brief file fastuidraw_bit_utils.glsl.hpp
4  *
5  * Copyright 2018 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 /*!\addtogroup GLSLVertFragCode
20  * @{
21  */
22 
23 /*!
24  * Utility function to extract bits from an uint value
25  * \param bit0 starting bit from which to unpack
26  * \param num_bits number bits to unpack
27  * \param src value from which to unpack
28  */
29 uint
30 fastuidraw_extract_bits(uint bit0, uint num_bits, uint src)
31 {
32  return (src << (32u - bit0 - num_bits)) >> (32u - num_bits);
33 }
34 
35 /*!
36  * \def FASTUIDRAW_EXTRACT_BITS(bit0, num_bits, src)
37  * Macro that wraps \ref fastuidraw_extract_bits() so that
38  * each argument is casted into a uint.
39  * \param bit0 starting bit from which to unpack
40  * \param num_bits number bits to unpack
41  * \param src value from which to unpack
42  */
43 #define FASTUIDRAW_EXTRACT_BITS(bit0, num_bits, src) \
44  fastuidraw_extract_bits(uint(bit0), uint(num_bits), uint(src))
45 
46 /*!
47  * Function that does nothing (i.e. utterly empty implementation
48  * contents).
49  */
50 void
52 {}
53 
54 /*! @} */
uint fastuidraw_extract_bits(uint bit0, uint num_bits, uint src)
void fastuidraw_do_nothing(void)