C helper utils and macros