Cleanup address expressions for readability and using only unsigned arithmetics
This commit is contained in:
parent
cb0573b750
commit
087793c68e
1 changed files with 5 additions and 5 deletions
|
@ -78,10 +78,10 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
|
||||||
|
|
||||||
/* Very unlikely condition: Relocator may risk overwrite itself.
|
/* Very unlikely condition: Relocator may risk overwrite itself.
|
||||||
Just move it a bit up. */
|
Just move it a bit up. */
|
||||||
if ((grub_uint8_t *) UINT_TO_PTR (dest) - (grub_uint8_t *) relocator
|
if ((grub_addr_t) dest < (grub_addr_t) relocator
|
||||||
< (signed) (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN)
|
+ (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN)
|
||||||
&& (grub_uint8_t *) UINT_TO_PTR (dest) - (grub_uint8_t *) relocator
|
&& (grub_addr_t) dest + (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
|
||||||
> - (signed) (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN))
|
> (grub_addr_t) relocator)
|
||||||
{
|
{
|
||||||
void *relocator_new = ((grub_uint8_t *) relocator)
|
void *relocator_new = ((grub_uint8_t *) relocator)
|
||||||
+ (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
|
+ (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
|
||||||
|
@ -95,7 +95,7 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
|
||||||
relocator = relocator_new;
|
relocator = relocator_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UINT_TO_PTR (dest) >= relocator)
|
if ((grub_addr_t) dest >= (grub_addr_t) relocator)
|
||||||
{
|
{
|
||||||
int overhead;
|
int overhead;
|
||||||
overhead = dest -
|
overhead = dest -
|
||||||
|
|
Loading…
Reference in a new issue