| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SKSL_UTIL | 8 #ifndef SKSL_UTIL |
| 9 #define SKSL_UTIL | 9 #define SKSL_UTIL |
| 10 | 10 |
| 11 #include <iomanip> | 11 #include <iomanip> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <sstream> | 13 #include <sstream> |
| 14 #include "stdlib.h" | 14 #include "stdlib.h" |
| 15 #include "assert.h" | 15 #include "assert.h" |
| 16 #include "SkTypes.h" | 16 #include "SkTypes.h" |
| 17 | 17 |
| 18 namespace SkSL { | 18 namespace SkSL { |
| 19 | 19 |
| 20 // our own definitions of certain std:: functions, because they are not always p
resent on Android | 20 // our own definitions of certain std:: functions, because they are not always p
resent on Android |
| 21 | 21 |
| 22 template <typename T> std::string to_string(T value) { | 22 std::string to_string(double value); |
| 23 std::stringstream buffer; | 23 |
| 24 buffer << std::setprecision(std::numeric_limits<T>::digits10) << value; | 24 std::string to_string(int32_t value); |
| 25 return buffer.str(); | 25 |
| 26 } | 26 std::string to_string(uint32_t value); |
| 27 |
| 28 std::string to_string(int64_t value); |
| 29 |
| 30 std::string to_string(uint64_t value); |
| 27 | 31 |
| 28 #if _MSC_VER | 32 #if _MSC_VER |
| 29 #define NORETURN __declspec(noreturn) | 33 #define NORETURN __declspec(noreturn) |
| 30 #else | 34 #else |
| 31 #define NORETURN __attribute__((__noreturn__)) | 35 #define NORETURN __attribute__((__noreturn__)) |
| 32 #endif | 36 #endif |
| 33 int stoi(std::string s); | 37 int stoi(std::string s); |
| 34 | 38 |
| 35 double stod(std::string s); | 39 double stod(std::string s); |
| 36 | 40 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 #define ASSERT_RESULT(x) x | 52 #define ASSERT_RESULT(x) x |
| 49 #endif | 53 #endif |
| 50 | 54 |
| 51 #ifdef SKIA | 55 #ifdef SKIA |
| 52 #define ABORT(...) { SkDebugf(__VA_ARGS__); sksl_abort(); } | 56 #define ABORT(...) { SkDebugf(__VA_ARGS__); sksl_abort(); } |
| 53 #else | 57 #else |
| 54 #define ABORT(...) { sksl_abort(); } | 58 #define ABORT(...) { sksl_abort(); } |
| 55 #endif | 59 #endif |
| 56 | 60 |
| 57 #endif | 61 #endif |
| OLD | NEW |