Refactor: move ntohll to a separate helper library