1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.u8aEq = void 0;
|
4 | const toU8a_js_1 = require("./toU8a.js");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | function u8aEq(a, b) {
|
20 | const u8aa = (0, toU8a_js_1.u8aToU8a)(a);
|
21 | const u8ab = (0, toU8a_js_1.u8aToU8a)(b);
|
22 | if (u8aa.length === u8ab.length) {
|
23 | const dvA = new DataView(u8aa.buffer, u8aa.byteOffset);
|
24 | const dvB = new DataView(u8ab.buffer, u8ab.byteOffset);
|
25 | const mod = (u8aa.length % 4) | 0;
|
26 | const length = (u8aa.length - mod) | 0;
|
27 | for (let i = 0; i < length; i += 4) {
|
28 | if (dvA.getUint32(i) !== dvB.getUint32(i)) {
|
29 | return false;
|
30 | }
|
31 | }
|
32 | for (let i = length, count = u8aa.length; i < count; i++) {
|
33 | if (u8aa[i] !== u8ab[i]) {
|
34 | return false;
|
35 | }
|
36 | }
|
37 | return true;
|
38 | }
|
39 | return false;
|
40 | }
|
41 | exports.u8aEq = u8aEq;
|