VirtualBox

Changeset 58955 in vbox for trunk/include


Ignore:
Timestamp:
Dec 2, 2015 3:59:59 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
104467
Message:

iprt/cdefs.h: Added the RT_BF_SET and RT_BF_CLEAR macros.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cdefs.h

    r58953 r58955  
    15131513 *      - \<a_FieldNm\>_MASK:  The field mask.
    15141514 *
     1515 * @returns The bit field value.
    15151516 * @param   a_uValue        The integer value containing the field.
    15161517 * @param   a_FieldNm       The field name prefix for getting at the _SHIFT and
    15171518 *                          _MASK macros.
    1518  * @sa      #RT_BF_MAKE, #RT_BF_ZMASK
     1519 * @sa      #RT_BF_CLEAR, #RT_BF_SET, #RT_BF_MAKE, #RT_BF_ZMASK
    15191520 */
    15201521#define RT_BF_GET(a_uValue, a_FieldNm)          ( ((a_uValue) >> RT_CONCAT(a_FieldNm,_SHIFT)) & RT_BF_ZMASK(a_FieldNm) )
     1522
     1523/** @def RT_BF_SET
     1524 * Sets the given bit field in the integer value.
     1525 *
     1526 * This requires a couple of macros to be defined for the field:
     1527 *      - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
     1528 *      - \<a_FieldNm\>_MASK:  The field mask.  Must have the same type as the
     1529 *        integer value!!
     1530 *
     1531 * @returns Integer value with bit field set to @a a_uFieldValue.
     1532 * @param   a_uValue        The integer value containing the field.
     1533 * @param   a_FieldNm       The field name prefix for getting at the _SHIFT and
     1534 *                          _MASK macros.
     1535 * @param   a_uFieldValue   The new field value.
     1536 * @sa      #RT_BF_GET, #RT_BF_CLEAR, #RT_BF_MAKE, #RT_BF_ZMASK
     1537 */
     1538#define RT_BF_SET(a_uValue, a_FieldNm, a_uFieldValue) ( RT_BF_CLEAR(a_uValue, a_FieldNm) | RT_BF_MAKE(a_FieldNm, a_uFieldValue) )
     1539
     1540/** @def RT_BF_CLEAR
     1541 * Clears the given bit field in the integer value.
     1542 *
     1543 * This requires a couple of macros to be defined for the field:
     1544 *      - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
     1545 *      - \<a_FieldNm\>_MASK:  The field mask.  Must have the same type as the
     1546 *        integer value!!
     1547 *
     1548 * @returns Integer value with bit field set to zero.
     1549 * @param   a_uValue        The integer value containing the field.
     1550 * @param   a_FieldNm       The field name prefix for getting at the _SHIFT and
     1551 *                          _MASK macros.
     1552 * @sa      #RT_BF_GET, #RT_BF_SET, #RT_BF_MAKE, #RT_BF_ZMASK
     1553 */
     1554#define RT_BF_CLEAR(a_uValue, a_FieldNm)        ( (a_uValue) & ~RT_CONCAT(a_FieldNm,_MASK) )
    15211555
    15221556/** @def RT_BF_MAKE
     
    15311565 * @param   a_uFieldValue   The field value that should be masked and shifted
    15321566 *                          into position.
    1533  * @sa      #RT_BF_GET, #RT_BF_ZMASK
     1567 * @sa      #RT_BF_GET, #RT_BF_SET, #RT_BF_CLEAR, #RT_BF_ZMASK
    15341568 */
    15351569#define RT_BF_MAKE(a_FieldNm, a_uFieldValue)    ( ((a_uFieldValue) & RT_BF_ZMASK(a_FieldNm) ) << RT_CONCAT(a_FieldNm,_SHIFT) )
     
    15401574 * @param   a_FieldNm       The field name prefix for getting at the _SHIFT and
    15411575 *                          _MASK macros.
    1542  * @sa      #RT_BF_GET, #RT_BF_MAKE
     1576 * @sa      #RT_BF_GET, #RT_BF_SET, #RT_BF_CLEAR, #RT_BF_MAKE
    15431577 */
    15441578#define RT_BF_ZMASK(a_FieldNm)                  ( RT_CONCAT(a_FieldNm,_MASK) >> RT_CONCAT(a_FieldNm,_SHIFT) )
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette