[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Check for the appropriate condition in types.h
From: |
Vladimir 'phcoder' Serbinenko |
Subject: |
Re: [PATCH] Check for the appropriate condition in types.h |
Date: |
Thu, 23 Jul 2009 17:40:44 +0200 |
> Thanks. I have though of an additional change: if it seems acceptable,
> apply the "new" version of the patch that I attach with this message. If
> it is not, just use the old version in the original post and I'll send
> the new change as another patch.
>
> The additional change is the refactoring of the UINT_TO_PTR macro. Given
> that we have a grub_addr_t type fulfilling a role similar to the
> standard uintptr_t (an integral type "long enough to hold a pointer and
> back"), there is no need for the conditional definition of UINT_TO_PTR
> as either casting to a 32 or 64-bit type: grub_addr_t is defined exactly
> like that.
I'm fine with that
>
> Furthermore, I have added a PTR_TO_UINT macro as a means to perform
> safer* "hard" pointer arithmetic that frequently comes up in low-level
> code without having to think of the types to cast to and back. This way,
> this random code: (in acpi.c)
> target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
> Would become:
> target = UINT_TO_PTR(((PTR_TO_UINT(target) - 1) | 0xf) + 1);
Actualy I should have used ALIGN_UP here
>
> Regarding the ChangeLog entry, I always have problems with them. What
> about this one?:
> 2009-07-23 Javier Martin <address@hidden>
> * include/grub/types.h (GRUB_CPU_SIZEOF_VOID_P): substitute for
This would suggest that you modify GRUB_CPU_SIZEOF_VOID_P macro which
isn't the case. I would prefer something like:
[GRUB_CPU_SIZEOF_VOID_P == 8]: Changed to ...
[GRUB_CPU_SIZEOF_LONG == 8]: ... this.
> GRUB_CPU_SIZEOF_LONG where appropriate
> (UINT_TO_PTR): move outside wordsize conditionals
> (PTR_TO_UINT): new macro
>
> --
> -- Lazy, Oblivious, Recurrent Disaster -- Habbit
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
- [PATCH] Check for the appropriate condition in types.h, Javier Martín, 2009/07/23
- Re: [PATCH] Check for the appropriate condition in types.h, Pavel Roskin, 2009/07/23
- Re: [PATCH] Check for the appropriate condition in types.h, Javier Martín, 2009/07/23
- Re: [PATCH] Check for the appropriate condition in types.h,
Vladimir 'phcoder' Serbinenko <=
- Re: [PATCH] Check for the appropriate condition in types.h, Javier Martín, 2009/07/23
- Re: [PATCH] Check for the appropriate condition in types.h, Pavel Roskin, 2009/07/23
- Re: [PATCH] Check for the appropriate condition in types.h, Vladimir 'phcoder' Serbinenko, 2009/07/23
- Re: [PATCH] Check for the appropriate condition in types.h, Pavel Roskin, 2009/07/23
- Re: [PATCH] Check for the appropriate condition in types.h, Javier Martín, 2009/07/25