From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 6CEFE6BD23; Tue, 13 Apr 2021 02:32:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6CEFE6BD23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618270371; bh=dJPM/NUzIVb0LkfQ7u69Qta8YAJ4rGWJXqQ+MkBANjs=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=G5kSUKF+bI0f9VF5An1OzYAeW73heQJFKQdZ7IxRBAQW5ULPwiV3G65eaEo6Md8EZ CxFRIDC1I2RS8R1QudKiAK1x/30Rp1MhfRT9sC6RRPRvNCUnA7Knh6ZJ+ofGY1f5fm SyurTooiWdmtNkXY4lGRu0mMuCnbGg6RgpHeP14E= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DD8186BD19 for ; Tue, 13 Apr 2021 02:32:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DD8186BD19 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lW62y-0002q0-0w; Tue, 13 Apr 2021 02:32:48 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <69aa47b1575b768da04cc579e70038f5be272027.1617984948.git.imeevma@gmail.com> Message-ID: <23d58d25-f012-f0c2-8c52-1f56fadb28eb@tarantool.org> Date: Tue, 13 Apr 2021 01:32:47 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <69aa47b1575b768da04cc579e70038f5be272027.1617984948.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D0F00AE41BB9A5343182A05F538085040B9C3E9B715D64E2318526A49F7887D5E1E083EC36F30A73E2A823E52514BDAFC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7FFEB5AA78C4D87BFC2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE79683A3C835791080EA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA658AF056BA96990CECCEF74911F90465143F6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249B0E9FD5D4288160ECC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C012F9184CEE6480E98941B15DA834481F9449624AB7ADAF372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16BC6EABA9B74D0DA47B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C9783102359154C5D8BDE50D9CEC0EA6A0B831 X-C1DE0DAB: 0D63561A33F958A54DFC6F5DBC995A4A1FC6274C8C8891CD5EB42B3DE08E4F93D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344E332383F80D58BB1CC04D0D014A8F3BCA3081C434CA4B1E3AC23B2E9E3F2C84FF3D817FB98F51071D7E09C32AA3244C661F132E1F0287C34ADFA7704E09C768E8FBBEFAE1C4874CFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojq8JA+pXcDumLHl9UTUoong== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638225FFE36CD54BABA7B1B4F246FDC4939613841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 24/52] sql: introduce mem_set_int() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Good job on the fixes! See 3 comments below. > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > index 937fa3272..075000218 100644 > --- a/src/box/sql/mem.c > +++ b/src/box/sql/mem.c > @@ -1384,8 +1393,9 @@ vdbe_mem_numerify(struct Mem *mem) > if ((mem->flags & (MEM_Int | MEM_UInt | MEM_Real | MEM_Null)) != 0) > return 0; > if ((mem->flags & MEM_Bool) != 0) { > - mem->u.u = mem->u.b; > - MemSetTypeFlag(mem, MEM_UInt); > + mem->u.u = (uint64_t)mem->u.b; > + mem->flags = MEM_UInt; > + mem->field_type = FIELD_TYPE_UNSIGNED; 1. Field type wasn't set before. Why did you change that? > return 0; > } > assert((mem->flags & (MEM_Blob | MEM_Str)) != 0); > @@ -1454,20 +1464,23 @@ sqlVdbeMemCast(Mem * pMem, enum field_type type) > return 0; > } > if ((pMem->flags & MEM_Bool) != 0) { > - pMem->u.u = pMem->u.b; > - MemSetTypeFlag(pMem, MEM_UInt); > + pMem->u.u = (uint64_t)pMem->u.b; > + pMem->flags = MEM_UInt; > + pMem->field_type = FIELD_TYPE_UNSIGNED; 2. Ditto. > return 0; > } > @@ -1801,10 +1826,15 @@ mem_convert_to_integer(struct Mem *mem) > double d = mem->u.r; > if (d >= (double)UINT64_MAX || d < (double)INT64_MIN) > return -1; > - if (d < (double)INT64_MAX) > - mem_set_int(mem, (int64_t) d, d < 0); > - else > - mem_set_int(mem, (uint64_t) d, false); > + if (d < 0.) { > + mem->u.i = (int64_t)d; > + mem->flags = MEM_Int; > + mem->field_type = FIELD_TYPE_INTEGER; > + } else { > + mem->u.u = (uint64_t)d; > + mem->flags = MEM_UInt; > + mem->field_type = FIELD_TYPE_UNSIGNED; 3. Previously it was FIELD_TYPE_INTEGER in both cases. Why did you change that?