Speed-up path element operations & comparisons

Avoid repeated expensive operations in `STPathElement` (e.g. calls to `base_uint::isZero`) and attempt to make comparisons of path elements faster by calculating a path id and using it to avoid expensive comparisons between `base_uint` objects.

This is pending a performance review.
I thought about that, but I didn't want to change the code too much. In retrospect it would have made sense. I'll adjust.