Fix compilation on macos
Fixes #75762
Inspired by the boost version of this: https://github.com/steinwurf/boost/blob/master/boost/align/detail/aligned_alloc_posix.hpp#L19 that uses this function for all the macos versions that we support: https://github.com/steinwurf/boost/blob/master/boost/align/aligned_alloc.hpp#L27
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75791
Approved by: https://github.com/malfet