Add functions and macros as used upstream.

Added highbit64() and howmany() which are used in recent upstream code.