[tarantool-patches] Re: [PATCH 12/13] sql: fixes an error in uint64 to double casting
n.pettik
korablev at tarantool.org
Mon Mar 25 18:15:01 MSK 2019
Merge with one of previous patches.
> On 15 Mar 2019, at 18:45, Stanislav Zudin <szudin at tarantool.org> wrote:
>
> ---
> src/box/sql/util.c | 2 +-
> src/box/sql/vdbeInt.h | 2 ++
> src/box/sql/vdbemem.c | 2 +-
> 3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/box/sql/util.c b/src/box/sql/util.c
> index 17268aaaa..d585dc0d5 100644
> --- a/src/box/sql/util.c
> +++ b/src/box/sql/util.c
> @@ -1318,7 +1318,7 @@ sqlAddInt64(i64 * pA, bool is_signedA, i64 iB, bool is_signedB)
> if (sum == INT64_MIN_MOD) {
> *pA = INT64_MIN;
> } else {
> - assert(sum < INT64_MAX);
> + assert(sum <= INT64_MAX);
> *pA = -(i64)sum;
> }
> return ATHR_SIGNED;
> diff --git a/src/box/sql/vdbeInt.h b/src/box/sql/vdbeInt.h
> index 42f22df52..2076a9a14 100644
> --- a/src/box/sql/vdbeInt.h
> +++ b/src/box/sql/vdbeInt.h
> @@ -251,6 +251,8 @@ struct Mem {
> #define MEM_Unsigned 0x20000 /* Value is unsigned integer.
> * Combine this flag with MEM_Int
> * if necessary */
> +#define MEM_UInt (MEM_Int | MEM_Unsigned)
> +
IMHO it is a terrible mess. Don’t use such macros.
If MEM_Unsigned can serve only as an attribute of
MEM_Int, then you could declare its value already
containing necessary bit.
More information about the Tarantool-patches
mailing list