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.