big_endian conversion: this should be more correct

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39279 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2010-11-02 21:13:30 +00:00
parent f058886908
commit 0ac16c5b3e
2 changed files with 2 additions and 5 deletions

View File

@ -199,8 +199,7 @@ ATADevice::ReadCapacity16(ATARequest *request)
data.block_size = B_HOST_TO_BENDIAN_INT32(fBlockSize); data.block_size = B_HOST_TO_BENDIAN_INT32(fBlockSize);
uint64 lastBlock = fTotalSectors - 1; uint64 lastBlock = fTotalSectors - 1;
data.lba = (((uint64)B_HOST_TO_BENDIAN_INT32(lastBlock >> 32)) << 32) data.lba = B_HOST_TO_BENDIAN_INT64(lastBlock);
| B_HOST_TO_BENDIAN_INT32(lastBlock);
TRACE("returning last block: %llu\n", data.lba); TRACE("returning last block: %llu\n", data.lba);
copy_sg_data(ccb, 0, ccb->data_length, &data, sizeof(data), false); copy_sg_data(ccb, 0, ccb->data_length, &data, sizeof(data), false);

View File

@ -76,9 +76,7 @@ periph_check_capacity(scsi_periph_device_info *device, scsi_ccb *request)
ACQUIRE_BEN(&device->mutex); ACQUIRE_BEN(&device->mutex);
if (res == B_OK && request->data_resid == 0) { if (res == B_OK && request->data_resid == 0) {
capacity = (((uint64)B_BENDIAN_TO_HOST_INT32( capacity = B_BENDIAN_TO_HOST_INT64(capacityLongResult.lba);
capacityLongResult.lba >> 32)) << 32)
| B_BENDIAN_TO_HOST_INT32(capacityLongResult.lba);
} else } else
capacity = 0; capacity = 0;
} }