[Tarantool-patches] [PATCH v5 47/52] sql: introduce mem_get_double()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Apr 15 03:17:41 MSK 2021


Thanks for the fixes!

> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index f7b6df0d9..1deb8e507 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -2791,7 +2789,7 @@ case OP_SeekGT: {       /* jump, in3 */
>  			 *        (x >  4.9)    ->     (x >= 5)
>  			 *        (x <= 4.9)    ->     (x <  5)
>  			 */
> -			if (pIn3->u.r<(double)iKey) {
> +			if (mem_get_double_unsafe(pIn3) < (double)iKey) {

Why did you change this and below? There was a check above that
pIn3 is double. So you can access u.r safely.

>  				assert(OP_SeekGE==(OP_SeekGT-1));
>  				assert(OP_SeekLT==(OP_SeekLE-1));
>  				assert((OP_SeekLE & 0x0001)==(OP_SeekGT & 0x0001));
> @@ -2801,7 +2799,7 @@ case OP_SeekGT: {       /* jump, in3 */
>  			/* If the approximation iKey is smaller than the actual real search
>  			 * term, substitute <= for < and > for >=.
>  			 */
> -			else if (pIn3->u.r>(double)iKey) {
> +			else if (mem_get_double_unsafe(pIn3) > (double)iKey) {
>  				assert(OP_SeekLE==(OP_SeekLT+1));
>  				assert(OP_SeekGT==(OP_SeekGE+1));
>  				assert((OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001));


More information about the Tarantool-patches mailing list