Use full 64-bit division.

* grub-core/kern/misc.c (grub_divmod64_full): Renamed to ...
	(grub_divmod64): ... this.
	* include/grub/misc.h (grub_divmod64): Removed. All users switch to full
	version.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-05-18 15:35:19 +02:00
parent b84f26c549
commit bf947d36e3
15 changed files with 46 additions and 44 deletions

View file

@ -649,7 +649,7 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data,
chunk_found:
{
grub_uint32_t stripen;
grub_uint64_t stripen;
grub_uint64_t stripe_offset;
grub_uint64_t off = addr - grub_le_to_cpu64 (key->offset);
unsigned redundancy = 1;
@ -679,10 +679,10 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data,
{
grub_uint64_t stripe_length;
grub_dprintf ("btrfs", "single\n");
stripe_length = grub_divmod64_full (grub_le_to_cpu64 (chunk->size),
grub_le_to_cpu16 (chunk->nstripes),
NULL);
stripen = grub_divmod64_full (off, stripe_length, &stripe_offset);
stripe_length = grub_divmod64 (grub_le_to_cpu64 (chunk->size),
grub_le_to_cpu16 (chunk->nstripes),
NULL);
stripen = grub_divmod64 (off, stripe_length, &stripe_offset);
csize = (stripen + 1) * stripe_length - off;
break;
}
@ -699,7 +699,7 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data,
case GRUB_BTRFS_CHUNK_TYPE_RAID0:
{
grub_uint64_t middle, high;
grub_uint32_t low;
grub_uint64_t low;
grub_dprintf ("btrfs", "RAID0\n");
middle = grub_divmod64 (off,
grub_le_to_cpu64 (chunk->stripe_length),
@ -715,7 +715,7 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data,
case GRUB_BTRFS_CHUNK_TYPE_RAID10:
{
grub_uint64_t middle, high;
grub_uint32_t low;
grub_uint64_t low;
middle = grub_divmod64 (off,
grub_le_to_cpu64 (chunk->stripe_length),
&low);
@ -760,7 +760,7 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data,
grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T
"+0x%" PRIxGRUB_UINT64_T " (%d stripes (%d substripes) of %"
PRIxGRUB_UINT64_T ") stripe %" PRIxGRUB_UINT32_T
PRIxGRUB_UINT64_T ") stripe %" PRIxGRUB_UINT64_T
" maps to 0x%" PRIxGRUB_UINT64_T "\n",
grub_le_to_cpu64 (key->offset),
grub_le_to_cpu64 (chunk->size),