OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 asm("int $3"); | 203 asm("int $3"); |
204 #else | 204 #else |
205 #error Unsupported host architecture. | 205 #error Unsupported host architecture. |
206 #endif | 206 #endif |
207 } | 207 } |
208 | 208 |
209 | 209 |
210 // ---------------------------------------------------------------------------- | 210 // ---------------------------------------------------------------------------- |
211 // Math functions | 211 // Math functions |
212 | 212 |
213 double ceiling(double x) { | |
214 // Correct buggy 'ceil' on some systems (i.e. FreeBSD, OS X) | |
215 if (-1.0 < x && x < 0.0) { | |
Sven Panne
2013/07/25 08:32:46
A ternary expresses the functional nature a bit mo
| |
216 return -0.0; | |
217 } else { | |
218 return ceil(x); | |
219 } | |
220 } | |
221 | |
222 | |
213 double modulo(double x, double y) { | 223 double modulo(double x, double y) { |
214 return fmod(x, y); | 224 return fmod(x, y); |
215 } | 225 } |
216 | 226 |
217 | 227 |
218 #define UNARY_MATH_FUNCTION(name, generator) \ | 228 #define UNARY_MATH_FUNCTION(name, generator) \ |
219 static UnaryMathFunction fast_##name##_function = NULL; \ | 229 static UnaryMathFunction fast_##name##_function = NULL; \ |
220 void init_fast_##name##_function() { \ | 230 void init_fast_##name##_function() { \ |
221 fast_##name##_function = generator; \ | 231 fast_##name##_function = generator; \ |
222 } \ | 232 } \ |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
939 return ntohl(value); | 949 return ntohl(value); |
940 } | 950 } |
941 | 951 |
942 | 952 |
943 Socket* OS::CreateSocket() { | 953 Socket* OS::CreateSocket() { |
944 return new POSIXSocket(); | 954 return new POSIXSocket(); |
945 } | 955 } |
946 | 956 |
947 | 957 |
948 } } // namespace v8::internal | 958 } } // namespace v8::internal |
OLD | NEW |