```\nfunction toTypedDataHash(\n    bytes32 domainSeparator,\n    bytes32 structHash\n) internal pure returns (bytes32 data) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        let ptr := mload(0x40)\n        mstore(ptr, "\x19\x01")\n        mstore(add(ptr, 0x02), domainSeparator)\n        mstore(add(ptr, 0x22), structHash)\n        data := keccak256(ptr, 0x42)\n    }\n}\n```\n