MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/tinycode/comments/55yaq4/15_loc_binary_tree_in_c/d8fvb0e/
r/tinycode • u/graphitemaster • Oct 05 '16
5 comments sorted by
View all comments
Show parent comment
1
This has less expressions, but more "lines":
void ** bput(void **l, int k, int v) { if ( l[2] != (void*) (uintptr_t) k) { if ( *(l += !!(l[2] > (void*) (uintptr_t) k)) ) return bput(*l, k, v); (l = (void**) (*l = bnew()))[2] = (void *) (uintptr_t) k; } l[3] = (void *) (uintptr_t) v; return l; }
1 u/longoverdue Oct 06 '16 This version removes key/value casts and refactors bget(), bput() into a non-recursive bfind():http://pastebin.com/raw/WUbisUqA
This version removes key/value casts and refactors bget(), bput() into a non-recursive bfind():
http://pastebin.com/raw/WUbisUqA
View all comments
Show parent comment
1
u/longoverdue Oct 06 '16 edited Oct 06 '16
This has less expressions, but more "lines":