-C New\svarint\sencoding\sgives\sa\smaximum\svarint\slength\sof\s9\sinstead\sof\s10.\s(CVS\s1395)
-D 2004-05-18T15:57:42
+C Remove\sdead\scode\sfrom\sutil.c\s(CVS\s1396)
+D 2004-05-18T22:03:43
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/trigger.c 11afe9abfba13a2ba142944c797c952e162d117f
F src/update.c 0cc7291dd0e0f82cf93085e49c973e8ef9e51fd5
F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f
-F src/util.c c2e92ba9bb3b10154ceea6f24bd28e17aa43e428
+F src/util.c 6d4339b7f05ccdacaebcce67e7fb8c5b880620e8
F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476
F src/vdbe.c 5cc6e41f2c9f24bbbf591ca538c097c0f7b41a3d
F src/vdbe.h 1d0d0b5741c7f46ab372a95a4305fed0ae09d466
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P b2def1852c5357629cf69f0071963f9883074a70
-R fcc6388df2907a9562ab1f06c18ae1d4
+P 61bdb53a363644074d01682fab8220078523676b
+R 4ce96fc8601455b203e1d075dc16c4ef
U drh
-Z e7da228fbe2303ffbc30d46f572dedcc
+Z 94a194243da33cd3a770a79c6fa71a6f
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
-** $Id: util.c,v 1.83 2004/05/18 15:57:42 drh Exp $
+** $Id: util.c,v 1.84 2004/05/18 22:03:43 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
return res;
}
-/*
-** Some powers of 64. These constants are needed in the
-** sqlite3RealToSortable() routine below.
-*/
-#define _64e3 (64.0 * 64.0 * 64.0)
-#define _64e4 (64.0 * 64.0 * 64.0 * 64.0)
-#define _64e15 (_64e3 * _64e4 * _64e4 * _64e4)
-#define _64e16 (_64e4 * _64e4 * _64e4 * _64e4)
-#define _64e63 (_64e15 * _64e16 * _64e16 * _64e16)
-#define _64e64 (_64e16 * _64e16 * _64e16 * _64e16)
-
-/*
-** The following procedure converts a double-precision floating point
-** number into a string. The resulting string has the property that
-** two such strings comparied using strcmp() or memcmp() will give the
-** same results as a numeric comparison of the original floating point
-** numbers.
-**
-** This routine is used to generate database keys from floating point
-** numbers such that the keys sort in the same order as the original
-** floating point numbers even though the keys are compared using
-** memcmp().
-**
-** The calling function should have allocated at least 14 characters
-** of space for the buffer z[].
-*/
-void sqlite3RealToSortable(double r, char *z){
- int neg;
- int exp;
- int cnt = 0;
-
- /* This array maps integers between 0 and 63 into base-64 digits.
- ** The digits must be chosen such at their ASCII codes are increasing.
- ** This means we can not use the traditional base-64 digit set. */
- static const char zDigit[] =
- "0123456789"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "|~";
- if( r<0.0 ){
- neg = 1;
- r = -r;
- *z++ = '-';
- } else {
- neg = 0;
- *z++ = '0';
- }
- exp = 0;
-
- if( r==0.0 ){
- exp = -1024;
- }else if( r<(0.5/64.0) ){
- while( r < 0.5/_64e64 && exp > -961 ){ r *= _64e64; exp -= 64; }
- while( r < 0.5/_64e16 && exp > -1009 ){ r *= _64e16; exp -= 16; }
- while( r < 0.5/_64e4 && exp > -1021 ){ r *= _64e4; exp -= 4; }
- while( r < 0.5/64.0 && exp > -1024 ){ r *= 64.0; exp -= 1; }
- }else if( r>=0.5 ){
- while( r >= 0.5*_64e63 && exp < 960 ){ r *= 1.0/_64e64; exp += 64; }
- while( r >= 0.5*_64e15 && exp < 1008 ){ r *= 1.0/_64e16; exp += 16; }
- while( r >= 0.5*_64e3 && exp < 1020 ){ r *= 1.0/_64e4; exp += 4; }
- while( r >= 0.5 && exp < 1023 ){ r *= 1.0/64.0; exp += 1; }
- }
- if( neg ){
- exp = -exp;
- r = -r;
- }
- exp += 1024;
- r += 0.5;
- if( exp<0 ) return;
- if( exp>=2048 || r>=1.0 ){
- strcpy(z, "~~~~~~~~~~~~");
- return;
- }
- *z++ = zDigit[(exp>>6)&0x3f];
- *z++ = zDigit[exp & 0x3f];
- while( r>0.0 && cnt<10 ){
- int digit;
- r *= 64.0;
- digit = (int)r;
- assert( digit>=0 && digit<64 );
- *z++ = zDigit[digit & 0x3f];
- r -= digit;
- cnt++;
- }
- *z = 0;
-}
-
#ifdef SQLITE_UTF8
/*
** X is a pointer to the first byte of a UTF-8 character. Increment