Skip to content

Commit dd233e0

Browse files
committed
mark Math.f16round and DataView.prototype.{ getFloat16, setFloat16 } as shipped from FF129
https://bugzilla.mozilla.org/show_bug.cgi?id=1903329
1 parent 1b968d5 commit dd233e0

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- Fixed [`Set.prototype.symmetricDifference` to call `this.has` in each iteration](https://bugs.webkit.org/show_bug.cgi?id=272679)
2929
- Fixed `Array.fromAsync` to [not call the `Array` constructor twice](https://bugs.webkit.org/show_bug.cgi?id=271703)
3030
- Added [`URL.parse`](https://url.spec.whatwg.org/#dom-url-parse)
31+
- [`Math.f16round` and `DataView.prototype.{ getFloat16, setFloat16 }`](https://github.com/tc39/proposal-float16array) marked as [shipped from FF129](https://bugzilla.mozilla.org/show_bug.cgi?id=1903329)
3132
- [`Symbol.asyncDispose`](https://github.com/tc39/proposal-explicit-resource-management) added and marked as supported from V8 ~ Chromium 127
3233
- Added [Deno 1.44](https://github.com/denoland/deno/releases/tag/v1.44.0) compat data mapping
3334
- Added Electron 32 compat data mapping

packages/core-js-compat/src/data.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,11 +2119,13 @@ export const data = {
21192119
},
21202120
'esnext.data-view.get-float16': {
21212121
deno: '1.43',
2122+
firefox: '129',
21222123
},
21232124
'esnext.data-view.get-uint8-clamped': {
21242125
},
21252126
'esnext.data-view.set-float16': {
21262127
deno: '1.43',
2128+
firefox: '129',
21272129
},
21282130
'esnext.data-view.set-uint8-clamped': {
21292131
},
@@ -2266,6 +2268,7 @@ export const data = {
22662268
},
22672269
'esnext.math.f16round': {
22682270
deno: '1.43',
2271+
firefox: '129',
22692272
},
22702273
// TODO: Remove from `core-js@4`
22712274
'esnext.math.iaddh': {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module.exports = function fromBase64(string /* , options */) {
2+
aString(string);
3+
var options = arguments.length > 1 ? anObjectOrUndefined(arguments[1]) : undefined;
4+
var alphabet = getAlphabetOption(options) === 'base64' ? base64Alphabet : base64UrlAlphabet;
5+
var strict = options ? !!options.strict : false;
6+
7+
var input = strict ? string : replace(string, SPACES, '');
8+
9+
if (input.length % 4 === 0) {
10+
if (stringSlice(input, -2) === '==') input = stringSlice(input, 0, -2);
11+
else if (stringSlice(input, -1) === '=') input = stringSlice(input, 0, -1);
12+
} else if (strict) throw new SyntaxError('Input is not correctly padded');
13+
14+
var lastChunkSize = input.length % 4;
15+
16+
switch (lastChunkSize) {
17+
case 1: throw new SyntaxError('Bad input length');
18+
case 2: input += 'AA'; break;
19+
case 3: input += 'A';
20+
}
21+
22+
var bytes = [];
23+
var i = 0;
24+
var inputLength = input.length;
25+
26+
var at = function (shift) {
27+
var chr = charAt(input, i + shift);
28+
if (!hasOwn(alphabet, chr)) throw new SyntaxError('Bad char in input: "' + chr + '"');
29+
return alphabet[chr] << (18 - 6 * shift);
30+
};
31+
32+
for (; i < inputLength; i += 4) {
33+
var triplet = at(0) + at(1) + at(2) + at(3);
34+
push(bytes, (triplet >> 16) & 255, (triplet >> 8) & 255, triplet & 255);
35+
}
36+
37+
var byteLength = bytes.length;
38+
39+
if (lastChunkSize === 2) {
40+
if (strict && bytes[byteLength - 2] !== 0) throw new SyntaxError(EXTRA_BITS);
41+
byteLength -= 2;
42+
} else if (lastChunkSize === 3) {
43+
if (strict && bytes[byteLength - 1] !== 0) throw new SyntaxError(EXTRA_BITS);
44+
byteLength--;
45+
}
46+
47+
return arrayFromConstructorAndList(Uint8Array, bytes, byteLength);
48+
};

0 commit comments

Comments
 (0)