Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart

Issue 2858353003: Move Dart versions of math.min() and math.max() into VM patch file. (Closed)
Patch Set: Merge branch 'master' into min-max Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Patch file for dart:math library. 5 // Patch file for dart:math library.
6 import 'dart:_foreign_helper' show JS; 6 import 'dart:_foreign_helper' show JS;
7 import 'dart:_js_helper' show patch, checkNum; 7 import 'dart:_js_helper' show patch, checkNum;
8 import 'dart:typed_data' show ByteData; 8 import 'dart:typed_data' show ByteData;
9 9
10 @patch 10 @patch
11 num/*=T*/ min/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) => 11 T min<T extends num>(T a, T b) =>
12 JS('num', r'Math.min(#, #)', checkNum(a), checkNum(b)) as num/*=T*/; 12 JS('num', r'Math.min(#, #)', checkNum(a), checkNum(b)) as T;
13 13
14 @patch 14 @patch
15 num/*=T*/ max/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) => 15 T max<T extends num>(T a, T b) =>
16 JS('num', r'Math.max(#, #)', checkNum(a), checkNum(b)) as num/*=T*/; 16 JS('num', r'Math.max(#, #)', checkNum(a), checkNum(b)) as T;
17 17
18 @patch 18 @patch
19 double sqrt(num x) => JS('num', r'Math.sqrt(#)', checkNum(x)); 19 double sqrt(num x) => JS('num', r'Math.sqrt(#)', checkNum(x));
20 20
21 @patch 21 @patch
22 double sin(num radians) => JS('num', r'Math.sin(#)', checkNum(radians)); 22 double sin(num radians) => JS('num', r'Math.sin(#)', checkNum(radians));
23 23
24 @patch 24 @patch
25 double cos(num radians) => JS('num', r'Math.cos(#)', checkNum(radians)); 25 double cos(num radians) => JS('num', r'Math.cos(#)', checkNum(radians));
26 26
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // last range of k*max .. 256**byteCount. 318 // last range of k*max .. 256**byteCount.
319 // TODO: Consider picking a higher byte count if the last range is a 319 // TODO: Consider picking a higher byte count if the last range is a
320 // significant portion of the entire range - a 50% chance of having 320 // significant portion of the entire range - a 50% chance of having
321 // to use two more bytes is no worse than always using one more. 321 // to use two more bytes is no worse than always using one more.
322 if (random - result + max < randomLimit) { 322 if (random - result + max < randomLimit) {
323 return result; 323 return result;
324 } 324 }
325 } 325 }
326 } 326 }
327 } 327 }
OLDNEW
« no previous file with comments | « no previous file | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698