erlc: relocate helper function