From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 4E7BE26A98 for ; Thu, 8 Aug 2019 17:34:49 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vl2SyFQ_T63w for ; Thu, 8 Aug 2019 17:34:42 -0400 (EDT) Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id F2FB626A95 for ; Thu, 8 Aug 2019 17:34:41 -0400 (EDT) Subject: [tarantool-patches] ***UNCHECKED*** Re: [PATCH 1/2] Move mp_compare_double_uint64() to trivia.h References: <2ff7204c9f8b908b028bec926635118ce1982674.1565120194.git.korablev@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Thu, 8 Aug 2019 23:37:10 +0200 MIME-Version: 1.0 In-Reply-To: <2ff7204c9f8b908b028bec926635118ce1982674.1565120194.git.korablev@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org, Nikita Pettik Hi! Thanks for the patch! > diff --git a/src/trivia/util.h b/src/trivia/util.h > index 1e01013db..ebfe0c392 100644 > --- a/src/trivia/util.h > +++ b/src/trivia/util.h > @@ -500,6 +500,20 @@ json_escape(char *buf, int size, const char *data); > } \ > } while(0) > > +#define COMPARE_RESULT(a, b) (a < b ? -1 : a > b) > + > +/** > + * Compare LHS with RHS, return a value <0, 0 or >0 depending on the > + * comparison result (strcmp-style). > + * Normally, K==1. If K==-1, the result is inverted (as if LHS and RHS > + * were swapped). > + * K is needed to enable tail call optimization in Release build. > + * NOINLINE attribute was added to avoid aggressive inlining which I guess, NOINLINE does not make sense anymore. But you can keep a comment, that inlining should not be added in future for the sake of tail call optimization. > + * resulted in over 2Kb code size for mp_compare_number. > + */ > +int > +double_compare_uint64(double lhs, uint64_t rhs, int k); > + > #if !defined(__cplusplus) && !defined(static_assert) > # define static_assert _Static_assert > #endif >