Put windows includes in indef. No need for an _alignedfree/_aligned_malloc on OS X as malloc returns 16-byte aligned memory.
Use std::min/std::max