port macros & functions