utils: ensure that byte-order conversion functions evaluate the argument only once