From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org, Nikita Pettik <korablev@tarantool.org> Subject: [tarantool-patches] ***UNCHECKED*** Re: [PATCH 1/2] Move mp_compare_double_uint64() to trivia.h Date: Thu, 8 Aug 2019 23:37:10 +0200 [thread overview] Message-ID: <e20c257a-441e-7481-7fbb-ea30e8828619@tarantool.org> (raw) In-Reply-To: <2ff7204c9f8b908b028bec926635118ce1982674.1565120194.git.korablev@tarantool.org> 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 >
next prev parent reply other threads:[~2019-08-08 21:34 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-06 22:02 [tarantool-patches] [PATCH 0/2] Fix border case in float-int comparison in SQL Nikita Pettik 2019-08-06 22:02 ` [tarantool-patches] [PATCH 1/2] Move mp_compare_double_uint64() to trivia.h Nikita Pettik 2019-08-08 21:37 ` Vladislav Shpilevoy [this message] 2019-08-14 10:36 ` [tarantool-patches] " n.pettik 2019-08-14 20:43 ` Vladislav Shpilevoy 2019-08-08 21:37 ` [tarantool-patches] ***UNCHECKED*** " Vladislav Shpilevoy 2019-08-06 22:02 ` [tarantool-patches] [PATCH 2/2] sql: use double_compare_uint64() for int<->float cmp Nikita Pettik 2019-08-22 12:31 ` [tarantool-patches] Re: [PATCH 0/2] Fix border case in float-int comparison in SQL Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=e20c257a-441e-7481-7fbb-ea30e8828619@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] ***UNCHECKED*** Re: [PATCH 1/2] Move mp_compare_double_uint64() to trivia.h' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox