@abaplint/runtime 2.8.16 → 2.8.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HexUInt8 = void 0;
|
|
4
|
+
/* eslint-disable no-bitwise */
|
|
4
5
|
const _parse_1 = require("../operators/_parse");
|
|
5
6
|
const float_1 = require("./float");
|
|
6
7
|
const xstring_1 = require("./xstring");
|
|
7
8
|
const throw_error_1 = require("../throw_error");
|
|
8
9
|
const integer8_1 = require("./integer8");
|
|
9
10
|
const REGEXP = /^(?![A-F0-9])/;
|
|
11
|
+
const LUT_HEX_4b = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
|
|
12
|
+
const LUT_HEX_8b = new Array(0x100);
|
|
13
|
+
for (let n = 0; n < 0x100; n++) {
|
|
14
|
+
LUT_HEX_8b[n] = `${LUT_HEX_4b[(n >>> 4) & 0xF]}${LUT_HEX_4b[n & 0xF]}`;
|
|
15
|
+
}
|
|
10
16
|
class HexUInt8 {
|
|
11
17
|
constructor(input) {
|
|
12
18
|
this.length = input?.length ? input?.length : 1;
|
|
@@ -105,7 +111,13 @@ class HexUInt8 {
|
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
get() {
|
|
108
|
-
return Buffer.from(this.value).toString("hex").toUpperCase();
|
|
114
|
+
// return Buffer.from(this.value).toString("hex").toUpperCase();
|
|
115
|
+
let out = "";
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
117
|
+
for (let idx = 0; idx < this.value.length; idx++) {
|
|
118
|
+
out += LUT_HEX_8b[this.value[idx]];
|
|
119
|
+
}
|
|
120
|
+
return out;
|
|
109
121
|
}
|
|
110
122
|
getOffset(input) {
|
|
111
123
|
let offset = input?.offset;
|
|
@@ -149,8 +161,13 @@ class HexUInt8 {
|
|
|
149
161
|
console.dir(this.value.subarray(offset, length ? offset + length : undefined));
|
|
150
162
|
console.dir(Buffer.from(this.value.subarray(offset, length ? offset + length : undefined)));
|
|
151
163
|
*/
|
|
152
|
-
const str = Buffer.from(this.value.subarray(offset, length ? offset + length : undefined)).toString("hex")
|
|
153
|
-
|
|
164
|
+
// const str = Buffer.from(this.value.subarray(offset, length ? offset + length : undefined)).toString("hex").toUpperCase();
|
|
165
|
+
let str = "";
|
|
166
|
+
const until = length ? offset + length : this.value.length;
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
168
|
+
for (let idx = offset; idx < until; idx++) {
|
|
169
|
+
str += LUT_HEX_8b[this.value[idx]];
|
|
170
|
+
}
|
|
154
171
|
return new xstring_1.XString().set(str);
|
|
155
172
|
}
|
|
156
173
|
}
|