follow Phil Bagwell's original approach
follow Phil Bagwell's original approach

* just algorithm written
* did not even check whether it compiles

Signed-off-by: Otto Linnemann <b6bd3c2c60f446aa869da5c2f87d47aaf2f43725@gmx.de>

linneman/libcutils,linneman/libcutils