| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2001 September 15 | 2 ** 2001 September 15 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 testcase( (*pA)==(-1) ); testcase( (*pA)==0 ); | 1303 testcase( (*pA)==(-1) ); testcase( (*pA)==0 ); |
| 1304 if( (*pA)>=0 ) return 1; | 1304 if( (*pA)>=0 ) return 1; |
| 1305 *pA -= iB; | 1305 *pA -= iB; |
| 1306 return 0; | 1306 return 0; |
| 1307 }else{ | 1307 }else{ |
| 1308 return sqlite3AddInt64(pA, -iB); | 1308 return sqlite3AddInt64(pA, -iB); |
| 1309 } | 1309 } |
| 1310 #endif | 1310 #endif |
| 1311 } | 1311 } |
| 1312 int sqlite3MulInt64(i64 *pA, i64 iB){ | 1312 int sqlite3MulInt64(i64 *pA, i64 iB){ |
| 1313 /* TODO(shess): Chromium Android clang generates a link error: | 1313 /* TODO(shess): Removing clang support because on many platforms it generates a |
| 1314 ** link error for this intrinsic: |
| 1314 ** undefined reference to '__mulodi4' | 1315 ** undefined reference to '__mulodi4' |
| 1315 ** UPDATE(shess): Also, apparently, 32-bit Linux clang. | 1316 ** http://crbug.com/701524 |
| 1316 */ | 1317 */ |
| 1317 #if GCC_VERSION>=5004000 || \ | 1318 #if GCC_VERSION>=5004000 |
| 1318 (CLANG_VERSION>=4000000 && !defined(__ANDROID__) && \ | |
| 1319 (!defined(__linux__) || !defined(__i386__))) | |
| 1320 return __builtin_mul_overflow(*pA, iB, pA); | 1319 return __builtin_mul_overflow(*pA, iB, pA); |
| 1321 #else | 1320 #else |
| 1322 i64 iA = *pA; | 1321 i64 iA = *pA; |
| 1323 if( iB>0 ){ | 1322 if( iB>0 ){ |
| 1324 if( iA>LARGEST_INT64/iB ) return 1; | 1323 if( iA>LARGEST_INT64/iB ) return 1; |
| 1325 if( iA<SMALLEST_INT64/iB ) return 1; | 1324 if( iA<SMALLEST_INT64/iB ) return 1; |
| 1326 }else if( iB<0 ){ | 1325 }else if( iB<0 ){ |
| 1327 if( iA>0 ){ | 1326 if( iA>0 ){ |
| 1328 if( iB<SMALLEST_INT64/iA ) return 1; | 1327 if( iB<SMALLEST_INT64/iA ) return 1; |
| 1329 }else if( iA<0 ){ | 1328 }else if( iA<0 ){ |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 if( pIn==0 ) return 0; | 1562 if( pIn==0 ) return 0; |
| 1564 mx = pIn[1]; | 1563 mx = pIn[1]; |
| 1565 i = 2; | 1564 i = 2; |
| 1566 do{ | 1565 do{ |
| 1567 const char *z = (const char*)&pIn[i+2]; | 1566 const char *z = (const char*)&pIn[i+2]; |
| 1568 if( strncmp(z,zName,nName)==0 && z[nName]==0 ) return pIn[i]; | 1567 if( strncmp(z,zName,nName)==0 && z[nName]==0 ) return pIn[i]; |
| 1569 i += pIn[i+1]; | 1568 i += pIn[i+1]; |
| 1570 }while( i<mx ); | 1569 }while( i<mx ); |
| 1571 return 0; | 1570 return 0; |
| 1572 } | 1571 } |
| OLD | NEW |