1"use strict"; 2/* 3 * Copyright (c) 2022-2025 Huawei Device Co., Ltd. 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16Object.defineProperty(exports, "__esModule", { value: true }); 17exports.bitsToPtr = exports.ptrToBits = exports.isSamePtr = exports.ptrToString = exports.isNullPtr = exports.nullptr = void 0; 18exports.nullptr = BigInt(0); 19function isNullPtr(value) { 20 return value === exports.nullptr; 21} 22exports.isNullPtr = isNullPtr; 23function ptrToString(ptr) { 24 return `0x${ptr.toString(16).padStart(8, "0")}`; 25} 26exports.ptrToString = ptrToString; 27function isSamePtr(a, b) { 28 return (a === b); 29} 30exports.isSamePtr = isSamePtr; 31// TODO rethink me 32function ptrToBits(ptr) { 33 let result = new Uint32Array(2); 34 let ptrBigInt = ptr; 35 result[0] = Number(ptrBigInt & BigInt(0xFFFFFFFF)); 36 result[1] = Number((ptrBigInt >> BigInt(32)) & BigInt(0xFFFFFFFF)); 37 return result; 38} 39exports.ptrToBits = ptrToBits; 40function bitsToPtr(array, offset) { 41 let ptrBigInt = BigInt(array[offset + 1]) & BigInt(0xFFFFFFFF); 42 ptrBigInt = (ptrBigInt << BigInt(32)) | (BigInt(array[offset]) & BigInt(0xFFFFFFFF)); 43 return ptrBigInt; 44} 45exports.bitsToPtr = bitsToPtr; 46//# sourceMappingURL=Wrapper.js.map