1337
1338 // Pack and extract shorts to/from ints:
1339
1340 inline int extract_low_short_from_int(jint x) {
1341 return x & 0xffff;
1342 }
1343
1344 inline int extract_high_short_from_int(jint x) {
1345 return (x >> 16) & 0xffff;
1346 }
1347
1348 inline int build_int_from_shorts( jushort low, jushort high ) {
1349 return ((int)((unsigned int)high << 16) | (unsigned int)low);
1350 }
1351
1352 // Convert pointer to intptr_t, for use in printing pointers.
1353 inline intptr_t p2i(const void * p) {
1354 return (intptr_t) p;
1355 }
1356
1357 // Printf-style formatters for fixed- and variable-width types as pointers and
1358 // integers. These are derived from the definitions in inttypes.h. If the platform
1359 // doesn't provide appropriate definitions, they should be provided in
1360 // the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp)
1361
1362 #define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false")
1363
1364 // Format 32-bit quantities.
1365 #define INT32_FORMAT "%" PRId32
1366 #define UINT32_FORMAT "%" PRIu32
1367 #define INT32_FORMAT_W(width) "%" #width PRId32
1368 #define UINT32_FORMAT_W(width) "%" #width PRIu32
1369
1370 #define PTR32_FORMAT "0x%08" PRIx32
1371
1372 // Format 64-bit quantities.
1373 #define INT64_FORMAT "%" PRId64
1374 #define UINT64_FORMAT "%" PRIu64
1375 #define UINT64_FORMAT_X "%" PRIx64
1376 #define INT64_FORMAT_W(width) "%" #width PRId64
|
1337
1338 // Pack and extract shorts to/from ints:
1339
1340 inline int extract_low_short_from_int(jint x) {
1341 return x & 0xffff;
1342 }
1343
1344 inline int extract_high_short_from_int(jint x) {
1345 return (x >> 16) & 0xffff;
1346 }
1347
1348 inline int build_int_from_shorts( jushort low, jushort high ) {
1349 return ((int)((unsigned int)high << 16) | (unsigned int)low);
1350 }
1351
1352 // Convert pointer to intptr_t, for use in printing pointers.
1353 inline intptr_t p2i(const void * p) {
1354 return (intptr_t) p;
1355 }
1356
1357 // swap a & b
1358 template<class T> static void swap(T& a, T& b) {
1359 T tmp = a;
1360 a = b;
1361 b = tmp;
1362 }
1363
1364 // Printf-style formatters for fixed- and variable-width types as pointers and
1365 // integers. These are derived from the definitions in inttypes.h. If the platform
1366 // doesn't provide appropriate definitions, they should be provided in
1367 // the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp)
1368
1369 #define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false")
1370
1371 // Format 32-bit quantities.
1372 #define INT32_FORMAT "%" PRId32
1373 #define UINT32_FORMAT "%" PRIu32
1374 #define INT32_FORMAT_W(width) "%" #width PRId32
1375 #define UINT32_FORMAT_W(width) "%" #width PRIu32
1376
1377 #define PTR32_FORMAT "0x%08" PRIx32
1378
1379 // Format 64-bit quantities.
1380 #define INT64_FORMAT "%" PRId64
1381 #define UINT64_FORMAT "%" PRIu64
1382 #define UINT64_FORMAT_X "%" PRIx64
1383 #define INT64_FORMAT_W(width) "%" #width PRId64
|