mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Reduce the size of the compiled binary by a couple of hundred bytes by
using a thigher packing of a transformation table in date.c. Suggested by [forum:/forumpost/4f6efbb2a9|forum post 4f6efbb2a9]. FossilOrigin-Name: c75ba4fa644d338d22813c17172b9975411fe6197e07fd584e3209e3beb78036
This commit is contained in:
13
manifest
13
manifest
@@ -1,5 +1,5 @@
|
||||
C Update\sthe\sREADME.md\sto\sinstruct\sthe\suser\sto\sremove\sthe\sfinal\scomment\sline\nfrom\sthe\s"manifest"\sfile\sbefore\susing\sit\sto\scompute\sthe\scheck-in\shash.
|
||||
D 2021-12-21T16:59:45.424
|
||||
C Reduce\sthe\ssize\sof\sthe\scompiled\sbinary\sby\sa\scouple\sof\shundred\sbytes\sby\nusing\sa\sthigher\spacking\sof\sa\stransformation\stable\sin\sdate.c.\nSuggested\sby\s[forum:/forumpost/4f6efbb2a9|forum\spost\s4f6efbb2a9].
|
||||
D 2021-12-23T00:16:06.350
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -498,7 +498,7 @@ F src/build.c 107e1ecc98ca8965c2e08fc283a06067a1d829b1a82531a6f0a0e0fa60e7b0c1
|
||||
F src/callback.c 106b585da1edd57d75fa579d823a5218e0bf37f191dbf7417eeb4a8a9a267dbc
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c 8159d5f706551861c18ec6c8f6bdf105e15ea00367f05d9ab65d31a1077facc1
|
||||
F src/date.c b49c12c7564ddd7f1922f76e7a086a6db5b91aa0e729b180cd433e22bab37be0
|
||||
F src/date.c ab8e01d928f201f5dee0bc6d54d6702fdcec96dff4d58c387447671f6a46d191
|
||||
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
|
||||
F src/dbstat.c 861e08690fcb0f2ee1165eff0060ea8d4f3e2ea10f80dab7d32ad70443a6ff2d
|
||||
F src/delete.c 19814f621cde10b1771a0dea7fe25d3d7d39975b8d4be4888537d30860e7c08c
|
||||
@@ -1934,7 +1934,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P d9f814a6402ca7fd999bbb847dc354b52ab9b97cae0c932344584d26c9430f24
|
||||
R db9606205e7c40e39afd2f95792c8925
|
||||
P 7b4f9d95a95f685ea4ee045e43c67b1a5c70e908e357b0b41d522699255663ce
|
||||
R 7b101808d3a49cd62c69eb0ecccc8da0
|
||||
U drh
|
||||
Z c2c3d0387ea5fddc68383e50b25ca47d
|
||||
Z 7db45fce779218ebd5032a4f8090eaaf
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@@ -1 +1 @@
|
||||
7b4f9d95a95f685ea4ee045e43c67b1a5c70e908e357b0b41d522699255663ce
|
||||
c75ba4fa644d338d22813c17172b9975411fe6197e07fd584e3209e3beb78036
|
31
src/date.c
31
src/date.c
@@ -617,18 +617,17 @@ static sqlite3_int64 localtimeOffset(
|
||||
** of several units of time.
|
||||
*/
|
||||
static const struct {
|
||||
u8 eType; /* Transformation type code */
|
||||
u8 nName; /* Length of th name */
|
||||
char *zName; /* Name of the transformation */
|
||||
double rLimit; /* Maximum NNN value for this transform */
|
||||
double rXform; /* Constant used for this transform */
|
||||
u8 nName; /* Length of the name */
|
||||
char zName[7]; /* Name of the transformation */
|
||||
float rLimit; /* Maximum NNN value for this transform */
|
||||
float rXform; /* Constant used for this transform */
|
||||
} aXformType[] = {
|
||||
{ 0, 6, "second", 464269060800.0, 1000.0 },
|
||||
{ 0, 6, "minute", 7737817680.0, 60000.0 },
|
||||
{ 0, 4, "hour", 128963628.0, 3600000.0 },
|
||||
{ 0, 3, "day", 5373485.0, 86400000.0 },
|
||||
{ 1, 5, "month", 176546.0, 2592000000.0 },
|
||||
{ 2, 4, "year", 14713.0, 31536000000.0 },
|
||||
{ 6, "second", 4.6427e+14, 1.0 },
|
||||
{ 6, "minute", 7.7379e+12, 60.0 },
|
||||
{ 4, "hour", 1.2897e+11, 3600.0 },
|
||||
{ 3, "day", 5373485.0, 86400.0 },
|
||||
{ 5, "month", 176546.0, 2592000.0 },
|
||||
{ 4, "year", 14713.0, 31536000.0 },
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -865,9 +864,10 @@ static int parseModifier(
|
||||
&& sqlite3_strnicmp(aXformType[i].zName, z, n)==0
|
||||
&& r>-aXformType[i].rLimit && r<aXformType[i].rLimit
|
||||
){
|
||||
switch( aXformType[i].eType ){
|
||||
case 1: { /* Special processing to add months */
|
||||
switch( i ){
|
||||
case 4: { /* Special processing to add months */
|
||||
int x;
|
||||
assert( strcmp(aXformType[i].zName,"month")==0 );
|
||||
computeYMD_HMS(p);
|
||||
p->M += (int)r;
|
||||
x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
|
||||
@@ -877,8 +877,9 @@ static int parseModifier(
|
||||
r -= (int)r;
|
||||
break;
|
||||
}
|
||||
case 2: { /* Special processing to add years */
|
||||
case 5: { /* Special processing to add years */
|
||||
int y = (int)r;
|
||||
assert( strcmp(aXformType[i].zName,"year")==0 );
|
||||
computeYMD_HMS(p);
|
||||
p->Y += y;
|
||||
p->validJD = 0;
|
||||
@@ -887,7 +888,7 @@ static int parseModifier(
|
||||
}
|
||||
}
|
||||
computeJD(p);
|
||||
p->iJD += (sqlite3_int64)(r*aXformType[i].rXform + rRounder);
|
||||
p->iJD += (sqlite3_int64)(r*1000.0*aXformType[i].rXform + rRounder);
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user