diff options
author | mdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2012-11-09 22:09:37 +0000 |
---|---|---|
committer | mdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2012-11-09 22:09:37 +0000 |
commit | 6f03504eeda8799fa1098c2f50a7570e1ed90e2a (patch) | |
tree | 0f8c91fbd5628d0a7791dfd8cb7713c084278364 /navit/item.c | |
parent | 8f2a5742605d56049aa8ca371877b30f19bae44b (diff) | |
download | navit-6f03504eeda8799fa1098c2f50a7570e1ed90e2a.tar.gz |
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
Diffstat (limited to 'navit/item.c')
-rw-r--r-- | navit/item.c | 22 |
1 files changed, 22 insertions, 0 deletions
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 * |