VirtualBox

Changeset 37535 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jun 17, 2011 12:34:53 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72371
Message:

iprt/cdefs.h: RT_HI/LO_Uxx macros.

File:
1 edited

Legend:

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

    r37012 r37535  
    13061306#define RT_BOOL(Value)                          ( !!(Value) )
    13071307
    1308 /** @def RT_LODWORD
    1309  * Gets the low dword (=uint32_t) of something. */
    1310 #define RT_LODWORD(a)                           ( (uint32_t)(a) )
    1311 
    1312 /** @def RT_HIDWORD
    1313  * Gets the high dword (=uint32_t) of a 64-bit of something. */
    1314 #define RT_HIDWORD(a)                           ( (uint32_t)((a) >> 32) )
    1315 
    1316 /** @def RT_LOWORD
    1317  * Gets the low word (=uint16_t) of something. */
    1318 #define RT_LOWORD(a)                            ( (a) & 0xffff )
    1319 
    1320 /** @def RT_HIWORD
    1321  * Gets the high word (=uint16_t) of a 32-bit something. */
    1322 #define RT_HIWORD(a)                            ( (a) >> 16 )
    1323 
    1324 /** @def RT_LOBYTE
    1325  * Gets the low byte of something. */
    1326 #define RT_LOBYTE(a)                            ( (a) & 0xff )
    1327 
    1328 /** @def RT_HIBYTE
    1329  * Gets the low byte of a 16-bit something. */
    1330 #define RT_HIBYTE(a)                            ( (a) >> 8 )
     1308/** @def RT_LO_U8
     1309 * Gets the low uint8_t of a uint16_t or something equivalent. */
     1310#ifdef __GNUC__
     1311# define RT_LO_U8(a)    __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint16_t)); (uint8_t)(a); })
     1312#else
     1313# define RT_LO_U8(a)                            ( (uint8_t)(a) )
     1314#endif
     1315/** @def RT_HI_U16
     1316 * Gets the high uint16_t of a uint32_t or something equivalent). */
     1317#ifdef __GNUC__
     1318# define RT_HI_U8(a)    __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint16_t)); (uint8_t)((a) >> 8); })
     1319#else
     1320# define RT_HI_U8(a)                            ( (uint8_t)((a) >> 8) )
     1321#endif
     1322
     1323/** @def RT_LO_U16
     1324 * Gets the low uint16_t of a uint32_t or something equivalent. */
     1325#ifdef __GNUC__
     1326# define RT_LO_U16(a)   __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)(a); })
     1327#else
     1328# define RT_LO_U16(a)                           ( (uint32_t)(a) )
     1329#endif
     1330/** @def RT_HI_U16
     1331 * Gets the high uint16_t of a uint32_t or something equivalent). */
     1332#ifdef __GNUC__
     1333# define RT_HI_U16(a)   __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint32_t)); (uint16_t)((a) >> 16); })
     1334#else
     1335# define RT_HI_U16(a)                           ( (uint16_t)((a) >> 16) )
     1336#endif
     1337
     1338/** @def RT_LO_U32
     1339 * Gets the low uint32_t of a uint64_t or something equivalent. */
     1340#ifdef __GNUC__
     1341# define RT_LO_U32(a)   __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)(a); })
     1342#else
     1343# define RT_LO_U32(a)                           ( (uint32_t)(a) )
     1344#endif
     1345/** @def RT_HI_U32
     1346 * Gets the high uint32_t of a uint64_t or something equivalent). */
     1347#ifdef __GNUC__
     1348# define RT_HI_U32(a)   __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)((a) >> 32); })
     1349#else
     1350# define RT_HI_U32(a)                           ( (uint32_t)((a) >> 32) )
     1351#endif
    13311352
    13321353/** @def RT_BYTE1
    13331354 * Gets the first byte of something. */
    1334 #define RT_BYTE1(a)                             ( (a) & 0xff )
    1335 
     1355#define RT_BYTE1(a)                             ( (a)         & 0xff )
    13361356/** @def RT_BYTE2
    13371357 * Gets the second byte of something. */
    1338 #define RT_BYTE2(a)                             ( ((a) >> 8) & 0xff )
    1339 
     1358#define RT_BYTE2(a)                             ( ((a) >>  8) & 0xff )
    13401359/** @def RT_BYTE3
    13411360 * Gets the second byte of something. */
    13421361#define RT_BYTE3(a)                             ( ((a) >> 16) & 0xff )
    1343 
    13441362/** @def RT_BYTE4
    13451363 * Gets the fourth byte of something. */
    13461364#define RT_BYTE4(a)                             ( ((a) >> 24) & 0xff )
    1347 
    13481365/** @def RT_BYTE5
    13491366 * Gets the fifth byte of something. */
    1350 #define RT_BYTE5(a)                             (((a) >> 32) & 0xff)
    1351 
     1367#define RT_BYTE5(a)                             ( ((a) >> 32) & 0xff )
    13521368/** @def RT_BYTE6
    13531369 * Gets the sixth byte of something. */
    1354 #define RT_BYTE6(a)                             (((a) >> 40) & 0xff)
    1355 
     1370#define RT_BYTE6(a)                             ( ((a) >> 40) & 0xff )
    13561371/** @def RT_BYTE7
    13571372 * Gets the seventh byte of something. */
    1358 #define RT_BYTE7(a)                             (((a) >> 48) & 0xff)
    1359 
     1373#define RT_BYTE7(a)                             ( ((a) >> 48) & 0xff )
    13601374/** @def RT_BYTE8
    13611375 * Gets the eight byte of something. */
    1362 #define RT_BYTE8(a)                             (((a) >> 56) & 0xff)
     1376#define RT_BYTE8(a)                             ( ((a) >> 56) & 0xff )
     1377
     1378
     1379/** @def RT_LODWORD
     1380 * Gets the low dword (=uint32_t) of something.
     1381 * @deprecated  Use RT_LO_U32. */
     1382#define RT_LODWORD(a)                           ( (uint32_t)(a) )
     1383/** @def RT_HIDWORD
     1384 * Gets the high dword (=uint32_t) of a 64-bit of something.
     1385 * @deprecated  Use RT_HI_U32. */
     1386#define RT_HIDWORD(a)                           ( (uint32_t)((a) >> 32) )
     1387
     1388/** @def RT_LOWORD
     1389 * Gets the low word (=uint16_t) of something.
     1390 * @deprecated  Use RT_LO_U16. */
     1391#define RT_LOWORD(a)                            ( (a) & 0xffff )
     1392/** @def RT_HIWORD
     1393 * Gets the high word (=uint16_t) of a 32-bit something.
     1394 * @deprecated  Use RT_HI_U16. */
     1395#define RT_HIWORD(a)                            ( (a) >> 16 )
     1396
     1397/** @def RT_LOBYTE
     1398 * Gets the low byte of something.
     1399 * @deprecated  Use RT_LO_U8. */
     1400#define RT_LOBYTE(a)                            ( (a) & 0xff )
     1401/** @def RT_HIBYTE
     1402 * Gets the low byte of a 16-bit something.
     1403 * @deprecated  Use RT_HI_U8. */
     1404#define RT_HIBYTE(a)                            ( (a) >> 8 )
    13631405
    13641406
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