System.register(["cc"], function (_export, _context) { "use strict"; var _cclegacy, SafeVarNumber, SafeConstNumber, _crd; function get_new_safe_number(num) { return new SafeVarNumber(num); } function get_new_safe_const_number(num) { return new SafeConstNumber(num); } _export({ get_new_safe_number: get_new_safe_number, get_new_safe_const_number: get_new_safe_const_number }); return { setters: [function (_cc) { _cclegacy = _cc.cclegacy; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "7e0d8kg6FBL46wNVfNiK7eE", "SafeNumber", undefined); /** * 防内存调试变量数字类型 */ SafeVarNumber = class SafeVarNumber { constructor(num = 0) { this.cache = 0; this.scale = 2; this.map = {}; this.idx = 0; this.value = num; } /**数值 */ get value() { if (Math.abs(this.map[this.idx] * this.scale - this.cache) > 0.000001) { this.map[this.idx] = this.cache / this.scale; } return this.map[this.idx]; } set value(num) { delete this.map[this.idx]; this.idx = Math.floor(Math.random() * 256); this.map[this.idx] = num; this.scale = Math.floor(Math.random() * 2) + 2; this.cache = num * this.scale; } valueOf() { return this.value; } toString() { return this.value.toString(); } clone() { return new SafeVarNumber(this.value); } }; /** * 防内存调试常量数字类型 */ SafeConstNumber = class SafeConstNumber { constructor(num = 0) { this.cache = 0; this.scale = 2; this.map = {}; this.idx = 0; this.idx = Math.floor(Math.random() * 256); this.map[this.idx] = num; this.scale = Math.floor(Math.random() * 2) + 2; this.cache = num * this.scale; } /**数值 */ get value() { let num = this.map[this.idx]; if (Math.abs(num * this.scale - this.cache) > 0.000001) { num = this.cache / this.scale; } delete this.map[this.idx]; this.idx = Math.floor(Math.random() * 256); this.map[this.idx] = num; return this.map[this.idx]; } valueOf() { return this.value; } toString() { return this.value.toString(); } clone() { return new SafeConstNumber(this.value); } }; _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=1d5d5546c48e71ed58dfa68bc6fecf1be163c751.js.map