From 6f03504eeda8799fa1098c2f50a7570e1ed90e2a Mon Sep 17 00:00:00 2001 From: mdankov Date: Fri, 9 Nov 2012 22:09:37 +0000 Subject: Add:core:Better waypoints handling, see #1040 |Based on ideas & patches from pini and antiram git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5264 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/item.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'navit/item.c') diff --git a/navit/item.c b/navit/item.c index 99cffecfc..58b33296b 100644 --- a/navit/item.c +++ b/navit/item.c @@ -304,6 +304,28 @@ item_id_equal(const void *a, const void *b) return (id_a->id_hi == id_b->id_hi && id_a->id_lo == id_b->id_lo); } +/** + * @brief Derive item id_lo and id_hi from pointer, considering pointer could be 32 or 64 bit wide but both ids are 32 bit. + * + * @param it reference to the item. + * @param id pointer to derive item id from. + * @return Nothing. + */ +void +item_id_from_ptr(struct item *item, void *id) +{ +#if !defined(__LP64__) && !defined(__LLP64__) && !defined(WIN64) + item->id_lo=(int) id; + item->id_hi=0; +#else +# ifndef _MSC_VER + item->id_lo=((long long)id)&0xFFFFFFFFll; +# else + item->id_lo=((long long)id)&0xFFFFFFFFi64; +# endif + item->id_hi=((long long)id)>>32; +#endif +} struct item_hash * -- cgit v1.2.1