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

Side by Side Diff: src/conversions.h

Issue 1529004: StringToInt rewritten. This version doesn't allocate memory for long decimals... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/conversions.cc » ('j') | src/conversions.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Convert from Number object to C integer. 93 // Convert from Number object to C integer.
94 static inline int32_t NumberToInt32(Object* number); 94 static inline int32_t NumberToInt32(Object* number);
95 static inline uint32_t NumberToUint32(Object* number); 95 static inline uint32_t NumberToUint32(Object* number);
96 96
97 97
98 // Converts a string into a double value according to ECMA-262 9.3.1 98 // Converts a string into a double value according to ECMA-262 9.3.1
99 double StringToDouble(const char* str, int flags, double empty_string_val = 0); 99 double StringToDouble(const char* str, int flags, double empty_string_val = 0);
100 double StringToDouble(String* str, int flags, double empty_string_val = 0); 100 double StringToDouble(String* str, int flags, double empty_string_val = 0);
101 101
102 // Converts a string into an integer. 102 // Converts a string into an integer.
103 int StringToInt(String* str, int index, int radix, double* value); 103 double StringToInt(String* str, int radix);
104 int StringToInt(const char* str, int index, int radix, double* value);
105 104
106 // Converts a double to a string value according to ECMA-262 9.8.1. 105 // Converts a double to a string value according to ECMA-262 9.8.1.
107 // The buffer should be large enough for any floating point number. 106 // The buffer should be large enough for any floating point number.
108 // 100 characters is enough. 107 // 100 characters is enough.
109 const char* DoubleToCString(double value, Vector<char> buffer); 108 const char* DoubleToCString(double value, Vector<char> buffer);
110 109
111 // Convert an int to a null-terminated string. The returned string is 110 // Convert an int to a null-terminated string. The returned string is
112 // located inside the buffer, but not necessarily at the start. 111 // located inside the buffer, but not necessarily at the start.
113 const char* IntToCString(int n, Vector<char> buffer); 112 const char* IntToCString(int n, Vector<char> buffer);
114 113
115 // Additional number to string conversions for the number type. 114 // Additional number to string conversions for the number type.
116 // The caller is responsible for calling free on the returned pointer. 115 // The caller is responsible for calling free on the returned pointer.
117 char* DoubleToFixedCString(double value, int f); 116 char* DoubleToFixedCString(double value, int f);
118 char* DoubleToExponentialCString(double value, int f); 117 char* DoubleToExponentialCString(double value, int f);
119 char* DoubleToPrecisionCString(double value, int f); 118 char* DoubleToPrecisionCString(double value, int f);
120 char* DoubleToRadixCString(double value, int radix); 119 char* DoubleToRadixCString(double value, int radix);
121 120
122 } } // namespace v8::internal 121 } } // namespace v8::internal
123 122
124 #endif // V8_CONVERSIONS_H_ 123 #endif // V8_CONVERSIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/conversions.cc » ('j') | src/conversions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698