memrchr() replacement for mac