News for hackers. Stuff that matters.

esneider

Re:Bit Twiddling Hacks (2005) on Sunday July 03, 2016 @03:49PM (#12027344)
I wrote that algorithm! A year later I found Hacker's delight, a wonderful book that had a much "faster" version of the same algorithm (less ops).

For anyone interested in this kind of things, you should go read that book. It actually is a delight.

Re:Talloc: The Tutorial on Sunday December 08, 2013 @09:28AM (#6869737)
Fair enough... I thought it would be more difficult/inefficient to check for cyclic hierarchies, but it wasn't.

Fixed! Thanks.

Re:Talloc: The Tutorial on Sunday December 08, 2013 @08:25AM (#6869631)
Yep, you can also do

  void *p;
  free(p);
  free(p);
Don't get me wrong, I get where you are going. But C philosophy is that libraries shouldn't do expensive checking to detect programmers' errors.
Re:Talloc: The Tutorial on Sunday December 08, 2013 @07:49AM (#6869593)
Hierarchical memory allocations are a great concept. But Samba's talloc is kind of bloated, with all the reference counting, destructors and stuff.

Here is a simple, 200-line version of just the hierarchical allocator: https://github.com/esneider/talloc