1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Encode a 64-bit integer literal in date.c as a constant expression so that

it works on older compilers.  Also fix a harmless compiler warning in vdbe.c.

FossilOrigin-Name: f57952bac652901e1bd48b68301941efbcf29dc4
This commit is contained in:
drh
2016-12-30 00:09:14 +00:00
parent 96ada59cbb
commit fb4e3a3bbb
4 changed files with 19 additions and 10 deletions

View File

@@ -395,13 +395,22 @@ static int parseDateOrTime(
return 1;
}
/* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
** Multiplying this by 86400000 gives 464269060799999 as the maximum value
** for DateTime.iJD.
**
** But some older compilers (ex: gcc 4.2.1 on older Macs) cannot deal with
** such a large integer literal, so we have to encode it.
*/
#define INT_464269060799999 ((((i64)0x1a640)<<32)|0x1072fdff)
/*
** Return TRUE if the given julian day number is within range.
**
** The input is the JulianDay times 86400000.
*/
static int validJulianDay(sqlite3_int64 iJD){
return iJD>=0 && iJD<=464269060799999;
return iJD>=0 && iJD<=INT_464269060799999;
}
/*