added missing define for mac, and added parentheses to surpress if-assignment warning