Convert cell2pointer() and pointer2cell() macros to inline functions

Inline functions suggested by Blue.

Use const void* for pointer2cell() due to const char* arguments.

Fix a misuse of pointer2cell().

Drop comment on reusing different host bitness code path;
any special handling for different target bitnesses should go
into these new functions.

v2:
* Use QEMU-style indentation for new inline functions.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@951 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Andreas Färber
2010-11-09 22:50:48 +00:00
committed by Andreas Färber
parent f3fc8ee4a4
commit 5131e8c560
2 changed files with 12 additions and 4 deletions

View File

@@ -31,9 +31,17 @@ typedef ucell phandle_t;
#ifdef NATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH
// XXX Check whether we can take the larger-than code path for ppc64 instead.
#define pointer2cell(x) ((ucell)(uintptr_t)(x))
#define cell2pointer(x) ((u8 *)(uintptr_t)(x))
static inline ucell pointer2cell(const void* x)
{
return (ucell)(uintptr_t)x;
}
static inline void* cell2pointer(ucell x)
{
return (void*)(uintptr_t)x;
}
#endif
static inline void PUSH(ucell value) {