Hello all, but specially Cedric and Jorge as one of you did initial eina_inlist and we're about to release eina as 1.0 so we need to know if things need/could be changed to improve things before that.
Today eina_inlist does not keep an accounting member as its eina_list counterpart, instead it keeps a pointer to "last" that is just valid on the head member (as we'll not walk the list updating all ->last as we append stuff). That leaves us with a sizeof(pointer) lost in every member but the first. Two options with that: - add accounting: suggested by raster, it does make sense as it would make eina_inlist_count() O(1) and behavior similar to eina_list, better use of that pointer. - ultra-dirty hack to remove extra pointer. The hack bases on the fact that we just use ->last from the first node, that always have the ->prev == NULL. So we could have the first ->prev == ->last, but how to know it's the first then, you might ask? Easy! Just use the fact that valid addresses are multiple of sizeof(word) and you're done, no supported platform uses less than 4 bytes, so ->prev = ->last | 1; would work, and checks for ->last & 1 would tell you if it's the case or not. The ultra dirty hack could be used to save the extra ->accounting from eina_list as well, and instead of adding last as said in the previous example, we could store accounting there. Dirty but useful, if people are using macros then we've almost no porting to do. As this uses ->prev (a not so used pointer in outer world) we don't have much work to do, just introduce EINA_LIST_FIRST_IS() and EINA_LIST_LAST_IS() (the last would still check for NULL, but just to make further changes easier). What do you think? Should we change eina_inlist to have an accounting and still use 3 pointers per node? Should we move to the said trick? Also for eina_list? SAY IT SOON OR LIVE WITH THAT :-D -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: [email protected] Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
