REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.93 KB
Close
/opt/alt/alt-nodejs9/root/lib/node_modules/npm/node_modules/tar/lib/large-numbers.js
Text
Base64
'use strict' // Tar can encode large and negative numbers using a leading byte of // 0xff for negative, and 0x80 for positive. The trailing byte in the // section will always be 0x20, or in some implementations 0x00. // this module encodes and decodes these things. const encode = exports.encode = (num, buf) => { buf[buf.length - 1] = 0x20 if (num < 0) encodeNegative(num, buf) else encodePositive(num, buf) return buf } const encodePositive = (num, buf) => { buf[0] = 0x80 for (var i = buf.length - 2; i > 0; i--) { if (num === 0) buf[i] = 0 else { buf[i] = num % 0x100 num = Math.floor(num / 0x100) } } } const encodeNegative = (num, buf) => { buf[0] = 0xff var flipped = false num = num * -1 for (var i = buf.length - 2; i > 0; i--) { var byte if (num === 0) byte = 0 else { byte = num % 0x100 num = Math.floor(num / 0x100) } if (flipped) buf[i] = onesComp(byte) else if (byte === 0) buf[i] = 0 else { flipped = true buf[i] = twosComp(byte) } } } const parse = exports.parse = (buf) => { var post = buf[buf.length - 1] var pre = buf[0] return pre === 0x80 ? pos(buf.slice(1, buf.length - 1)) : twos(buf.slice(1, buf.length - 1)) } const twos = (buf) => { var len = buf.length var sum = 0 var flipped = false for (var i = len - 1; i > -1; i--) { var byte = buf[i] var f if (flipped) f = onesComp(byte) else if (byte === 0) f = byte else { flipped = true f = twosComp(byte) } if (f !== 0) sum += f * Math.pow(256, len - i - 1) } return sum * -1 } const pos = (buf) => { var len = buf.length var sum = 0 for (var i = len - 1; i > -1; i--) { var byte = buf[i] if (byte !== 0) sum += byte * Math.pow(256, len - i - 1) } return sum } const onesComp = byte => (0xff ^ byte) & 0xff const twosComp = byte => ((0xff ^ byte) + 1) & 0xff
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 18
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
create.js
2.47 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
extract.js
3.00 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
header.js
8.28 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
high-level-opt.js
772 B
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
large-numbers.js
1.93 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
list.js
3.15 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
mkdir.js
5.08 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
pack.js
9.24 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
parse.js
11.58 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
pax.js
3.94 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
read-entry.js
2.41 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
replace.js
5.20 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
types.js
1.07 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
unpack.js
12.98 KB
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
update.js
852 B
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
warn-mixin.js
309 B
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
winchars.js
533 B
lrw-r--r--
2021-09-28 11:28:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
write-entry.js
10.86 KB
lrw-r--r--
2021-09-28 11:28:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).