2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_UTIL_FAST_STRTOLL_BASE10_H_
18 #define incl_HPHP_UTIL_FAST_STRTOLL_BASE10_H_
22 // This a fast version of strtoll() specialized for base 10. This version
23 // does not skip leading white space. It does not check for overflow/underflow,
24 // in which case the return value becomes different from strtoll(3c) that
25 // sets the result to LLONG_MAX/LLONG_MIN and errno to ERANGE.
26 // This function never sets errno. Thus a caller is responsible for making
27 // sure the value fits in [LLONG_MIN, LLONG_MAX] range.
28 inline int64_t fast_strtoll_base10(const char* p
) {
35 } else if (*p
== '+') {
38 while (*p
>= '0' && *p
<= '9') {
39 x
= (x
* 10) + ('0' - *p
);