"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyPacProxyS390XPatch = void 0;
const assert_1 = __importDefault(require("assert"));
const isBigEndian = new Int32Array(new Uint8Array([1, 0, 0, 0]).buffer)[0] !== 1;
if (isBigEndian) {
    exports.applyPacProxyS390XPatch = () => {
        const { ModuleMemory, } = require('@tootallnate/quickjs-emscripten/dist/memory');
        const { toPointerArray } = ModuleMemory.prototype;
        {
            const HEAPU8 = new Uint8Array(4);
            toPointerArray.call(new ModuleMemory({
                _malloc: () => 0,
                HEAPU8,
            }), [{ value: 0x01020304 }]);
            assert_1.default.deepStrictEqual([...HEAPU8], [1, 2, 3, 4]);
        }
        ModuleMemory.prototype.toPointerArray = function (handleArray) {
            return toPointerArray.call(this, handleArray.map(({ value }) => ({
                value: ((value & 0x000000ff) << 24) |
                    ((value & 0x0000ff00) << 8) |
                    ((value & 0x00ff0000) >> 8) |
                    ((value & 0xff000000) >> 24),
            })));
        };
    };
}
else {
    exports.applyPacProxyS390XPatch = () => {
    };
}
//# sourceMappingURL=pac-proxy-s390x-patch.js.map