ByteOrder.h: simplify compiler test
* A problem with our gcc requires adding casts for gcc4 when the __builtin_bswap functions are used with a format string * Unlike gcc2, the __builtin_bswap functions do not get disabled despite using -fno-builtins, hence added compiler check in runtime_loader/utility.cpp
This commit is contained in:
@@ -120,11 +120,7 @@ extern bool is_type_swapped(type_code type);
|
|||||||
/* Private implementations */
|
/* Private implementations */
|
||||||
extern double __swap_double(double arg);
|
extern double __swap_double(double arg);
|
||||||
extern float __swap_float(float arg);
|
extern float __swap_float(float arg);
|
||||||
#if (defined(__INTEL__) || defined(__x86_64__)) && GCC_VERSION >= 40300
|
#if __GNUC__ >= 4
|
||||||
#define __swap_int64(arg) __builtin_bswap64(arg)
|
|
||||||
#define __swap_int32(arg) __builtin_bswap32(arg)
|
|
||||||
#define __swap_int16(arg) __builtin_bswap16(arg)
|
|
||||||
#elif defined(__ARM__) && GCC_VERSION >= 40800
|
|
||||||
#define __swap_int64(arg) __builtin_bswap64(arg)
|
#define __swap_int64(arg) __builtin_bswap64(arg)
|
||||||
#define __swap_int32(arg) __builtin_bswap32(arg)
|
#define __swap_int32(arg) __builtin_bswap32(arg)
|
||||||
#define __swap_int16(arg) __builtin_bswap16(arg)
|
#define __swap_int16(arg) __builtin_bswap16(arg)
|
||||||
|
|||||||
@@ -819,8 +819,8 @@ AHCIPort::ScsiUnmap(scsi_ccb* request, scsi_unmap_parameter_list* unmapBlocks)
|
|||||||
dprintf("TRIM SCSI:\n");
|
dprintf("TRIM SCSI:\n");
|
||||||
for (uint32 i = 0; i < scsiRangeCount; i++) {
|
for (uint32 i = 0; i < scsiRangeCount; i++) {
|
||||||
dprintf("[%3" B_PRIu32 "] %" B_PRIu64 " : %" B_PRIu32 "\n", i,
|
dprintf("[%3" B_PRIu32 "] %" B_PRIu64 " : %" B_PRIu32 "\n", i,
|
||||||
B_BENDIAN_TO_HOST_INT64(unmapBlocks->blocks[i].lba),
|
(uint64)B_BENDIAN_TO_HOST_INT64(unmapBlocks->blocks[i].lba),
|
||||||
B_BENDIAN_TO_HOST_INT32(unmapBlocks->blocks[i].block_count));
|
(uint32)B_BENDIAN_TO_HOST_INT32(unmapBlocks->blocks[i].block_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 scsiIndex = 0;
|
uint32 scsiIndex = 0;
|
||||||
|
|||||||
@@ -1330,11 +1330,11 @@ arch_debug_gdb_get_registers(char* buffer, size_t bufferSize)
|
|||||||
switch (registers[i].type) {
|
switch (registers[i].type) {
|
||||||
case B_UINT64_TYPE:
|
case B_UINT64_TYPE:
|
||||||
result = snprintf(buffer, bufferSize, "%016" B_PRIx64,
|
result = snprintf(buffer, bufferSize, "%016" B_PRIx64,
|
||||||
B_HOST_TO_BENDIAN_INT64(registers[i].value));
|
(uint64)B_HOST_TO_BENDIAN_INT64(registers[i].value));
|
||||||
break;
|
break;
|
||||||
case B_UINT32_TYPE:
|
case B_UINT32_TYPE:
|
||||||
result = snprintf(buffer, bufferSize, "%08" B_PRIx32,
|
result = snprintf(buffer, bufferSize, "%08" B_PRIx32,
|
||||||
B_HOST_TO_BENDIAN_INT32((uint32)registers[i].value));
|
(uint32)B_HOST_TO_BENDIAN_INT32((uint32)registers[i].value));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (result >= (int)bufferSize)
|
if (result >= (int)bufferSize)
|
||||||
|
|||||||
@@ -72,13 +72,14 @@ dprintf(const char *format, ...)
|
|||||||
va_end(list);
|
va_end(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __GNUC__ == 2
|
||||||
extern "C" uint32
|
extern "C" uint32
|
||||||
__swap_int32(uint32 value)
|
__swap_int32(uint32 value)
|
||||||
{
|
{
|
||||||
return value >> 24 | ((value >> 8) & 0xff00) | value << 24
|
return value >> 24 | ((value >> 8) & 0xff00) | value << 24
|
||||||
| ((value << 8) & 0xff0000);
|
| ((value << 8) & 0xff0000);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Copied from libroot/os/thread.c:
|
// Copied from libroot/os/thread.c:
|
||||||
|
|||||||
Reference in New Issue
Block a user