{"thread":{"id":"17842","subject":"[PATCH] rev-list: estimate number of bisection step left","startedAt":"2009-02-17T05:09:44Z","lastAt":"2009-02-19T06:49:18Z","messageCount":13,"participants":["Christian Couder","Junio C Hamano","Johannes Schindelin","John Tapsell","Thomas Rast"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"105072","messageId":"20090217060944.488184b0.chriscool@tuxfamily.org","threadId":"17842","inReplyTo":null,"subject":"[PATCH] rev-list: estimate number of bisection step left","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-02-17T05:09:44Z","receivedAt":"2009-02-17T05:09:44Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This patch teaches \"git rev-list --bisect-vars\" to output an estimate\nof the number of bisection step left along with the other variables it\nalready outputs.\n\nThe estimate is calculated using log2(all_revisions_left/2 - 1).\nThis is the most straightforward formula and seems to work fine in\npractice.\n\nWe substract 1 to \"all_revisions_left/2\" because we allready know one\nbad revision.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n builtin-rev-list.c |   27 +++++++++++++++++++++++++--\n git-bisect.sh      |    2 +-\n 2 files changed, 26 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex 436afa4..ee4abe7 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -574,6 +574,27 @@ static struct commit_list *find_bisection(struct commit_list *list,\n \treturn best;\n }\n \n+/*\n+ * Estimate the number of bisect steps left\n+ * Taking log2(all_revisions_left/2 - 1) seems to work fine.\n+ * \"- 1\" is because we already know one bad revision.\n+ */\n+static int estimate_bisect_steps(int all)\n+{\n+\tint log2 = 0;\n+\tint left = (all >> 1) - 1;\n+\n+\tif (left <= 0)\n+\t\treturn 0;\n+\n+\tdo {\n+\t\tleft = left >> 1;\n+\t\tlog2++;\n+\t} while (left);\n+\n+\treturn log2;\n+}\n+\n int cmd_rev_list(int argc, const char **argv, const char *prefix)\n {\n \tstruct commit_list *list;\n@@ -688,12 +709,14 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\t\t       \"bisect_nr=%d\\n\"\n \t\t\t       \"bisect_good=%d\\n\"\n \t\t\t       \"bisect_bad=%d\\n\"\n-\t\t\t       \"bisect_all=%d\\n\",\n+\t\t\t       \"bisect_all=%d\\n\"\n+\t\t\t       \"bisect_steps=%d\\n\",\n \t\t\t       hex,\n \t\t\t       cnt - 1,\n \t\t\t       all - reaches - 1,\n \t\t\t       reaches - 1,\n-\t\t\t       all);\n+\t\t\t       all,\n+\t\t\t       estimate_bisect_steps(all));\n \t\t\treturn 0;\n \t\t}\n \t}\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 85db4ba..6b23439 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -500,7 +500,7 @@ bisect_next() {\n \t# commit is also a \"skip\" commit (see above).\n \texit_if_skipped_commits \"$bisect_rev\"\n \n-\tbisect_checkout \"$bisect_rev\" \"$bisect_nr revisions left to test after this\"\n+\tbisect_checkout \"$bisect_rev\" \"$bisect_nr revisions left to test after this (roughtly $bisect_steps steps)\"\n }\n \n bisect_visualize() {\n-- \n1.6.2.rc0.90.g0753.dirty\n"},{"id":"105086","messageId":"7vljs58qul.fsf@gitster.siamese.dyndns.org","threadId":"17842","inReplyTo":"20090217060944.488184b0.chriscool@tuxfamily.org","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-17T07:28:18Z","receivedAt":"2009-02-17T07:28:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> +static int estimate_bisect_steps(int all)\n> +{\n> +\tint log2 = 0;\n> +\tint left = (all >> 1) - 1;\n> +\n> +\tif (left <= 0)\n> +\t\treturn 0;\n> +\n> +\tdo {\n> +\t\tleft = left >> 1;\n> +\t\tlog2++;\n> +\t} while (left);\n> +\n> +\treturn log2;\n> +}\n> ...\n> diff --git a/git-bisect.sh b/git-bisect.sh\n> index 85db4ba..6b23439 100755\n> --- a/git-bisect.sh\n> +++ b/git-bisect.sh\n> @@ -500,7 +500,7 @@ bisect_next() {\n>  \t# commit is also a \"skip\" commit (see above).\n>  \texit_if_skipped_commits \"$bisect_rev\"\n>  \n> -\tbisect_checkout \"$bisect_rev\" \"$bisect_nr revisions left to test after this\"\n> +\tbisect_checkout \"$bisect_rev\" \"$bisect_nr revisions left to test after this (roughtly $bisect_steps steps)\"\n\n\"roughly\".\n\nall\tleft\n0\t0\n1\t0\n2\t0\n3\t0\n4\t1\n5\t1\n6\t2\n7\t2\n8\t2\n9\t2\n\nIt seems that at the very low end the estimate is a bit too optimistic.\nHow about showing this number from the Porcelain only when $bisect_steps\nis more than 2 (or all is more than 9)?\n"},{"id":"105158","messageId":"alpine.DEB.1.00.0902171542490.6185@intel-tinevez-2-302","threadId":"17842","inReplyTo":"20090217060944.488184b0.chriscool@tuxfamily.org","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-17T14:44:54Z","receivedAt":"2009-02-17T14:44:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 17 Feb 2009, Christian Couder wrote:\n\n> +static int estimate_bisect_steps(int all)\n> +{\n> +\tint log2 = 0;\n> +\tint left = (all >> 1) - 1;\n> +\n> +\tif (left <= 0)\n> +\t\treturn 0;\n> +\n> +\tdo {\n> +\t\tleft = left >> 1;\n> +\t\tlog2++;\n> +\t} while (left);\n> +\n> +\treturn log2;\n> +}\n\nHow about this instead, calling it from cmd_rev_list directly?\n\n\tstatic int log2(int n)\n\t{\n\t\tint log2;\n\n\t\tfor (log2 = 0; n > 1; log2++)\n\t\t\tn >>= 1;\n\n\t\treturn log2;\n\t}\n\nCiao,\nDscho\n"},{"id":"105160","messageId":"43d8ce650902170711r1edb1e40udfacce4b9123b0a5@mail.gmail.com","threadId":"17842","inReplyTo":"alpine.DEB.1.00.0902171542490.6185@intel-tinevez-2-302","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2009-02-17T15:11:18Z","receivedAt":"2009-02-17T15:11:18Z","isPatch":true,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Hi,\n>\n> On Tue, 17 Feb 2009, Christian Couder wrote:\n>\n>> +static int estimate_bisect_steps(int all)\n>> +{\n>> +     int log2 = 0;\n>> +     int left = (all >> 1) - 1;\n>> +\n>> +     if (left <= 0)\n>> +             return 0;\n>> +\n>> +     do {\n>> +             left = left >> 1;\n>> +             log2++;\n>> +     } while (left);\n>> +\n>> +     return log2;\n>> +}\n>\n> How about this instead, calling it from cmd_rev_list directly?\n>\n>        static int log2(int n)\n>        {\n>                int log2;\n>\n>                for (log2 = 0; n > 1; log2++)\n>                        n >>= 1;\n>\n>                return log2;\n>        }\n\nThis would work, if you want a non-iterative solution\n\nunsigned int log2_integer_approximate(unsigned int n){\n*((float*)&n) = (float)n;\nreturn ((n & (~((1<<23) - 1))) >> 23) - 127;\n}\n\n(It's correct up to 2^25, then it's off by 1 for a few.)\n\n\n> Ciao,\n> Dscho\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"105165","messageId":"alpine.DEB.1.00.0902171630130.6185@intel-tinevez-2-302","threadId":"17842","inReplyTo":"43d8ce650902170711r1edb1e40udfacce4b9123b0a5@mail.gmail.com","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-17T15:31:43Z","receivedAt":"2009-02-17T15:31:43Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 17 Feb 2009, John Tapsell wrote:\n\n> 2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>\n> > On Tue, 17 Feb 2009, Christian Couder wrote:\n> >\n> >> +static int estimate_bisect_steps(int all)\n> >> +{\n> >> +     int log2 = 0;\n> >> +     int left = (all >> 1) - 1;\n> >> +\n> >> +     if (left <= 0)\n> >> +             return 0;\n> >> +\n> >> +     do {\n> >> +             left = left >> 1;\n> >> +             log2++;\n> >> +     } while (left);\n> >> +\n> >> +     return log2;\n> >> +}\n> >\n> > How about this instead, calling it from cmd_rev_list directly?\n> >\n> >        static int log2(int n)\n> >        {\n> >                int log2;\n> >\n> >                for (log2 = 0; n > 1; log2++)\n> >                        n >>= 1;\n> >\n> >                return log2;\n> >        }\n> \n> This would work, if you want a non-iterative solution\n> \n> unsigned int log2_integer_approximate(unsigned int n){\n> *((float*)&n) = (float)n;\n> return ((n & (~((1<<23) - 1))) >> 23) - 127;\n> }\n\nThat assumes that your floats are IEEE floats, right?\n\nCiao,\nDscho\n"},{"id":"105167","messageId":"43d8ce650902170736h6316f987qc783edeebf488b40@mail.gmail.com","threadId":"17842","inReplyTo":"alpine.DEB.1.00.0902171630130.6185@intel-tinevez-2-302","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2009-02-17T15:36:03Z","receivedAt":"2009-02-17T15:36:03Z","isPatch":true,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Hi,\n>\n> On Tue, 17 Feb 2009, John Tapsell wrote:\n>\n>> 2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>>\n>> > On Tue, 17 Feb 2009, Christian Couder wrote:\n>> >\n>> >> +static int estimate_bisect_steps(int all)\n>> >> +{\n>> >> +     int log2 = 0;\n>> >> +     int left = (all >> 1) - 1;\n>> >> +\n>> >> +     if (left <= 0)\n>> >> +             return 0;\n>> >> +\n>> >> +     do {\n>> >> +             left = left >> 1;\n>> >> +             log2++;\n>> >> +     } while (left);\n>> >> +\n>> >> +     return log2;\n>> >> +}\n>> >\n>> > How about this instead, calling it from cmd_rev_list directly?\n>> >\n>> >        static int log2(int n)\n>> >        {\n>> >                int log2;\n>> >\n>> >                for (log2 = 0; n > 1; log2++)\n>> >                        n >>= 1;\n>> >\n>> >                return log2;\n>> >        }\n>>\n>> This would work, if you want a non-iterative solution\n>>\n>> unsigned int log2_integer_approximate(unsigned int n){\n>> *((float*)&n) = (float)n;\n>> return ((n & (~((1<<23) - 1))) >> 23) - 127;\n>> }\n>\n> That assumes that your floats are IEEE floats, right?\n\nYeah.  Is it a bad assumption? Does git run on any system in which they aren't?\n\n>\n> Ciao,\n> Dscho\n>\n"},{"id":"105168","messageId":"200902171639.35926.trast@student.ethz.ch","threadId":"17842","inReplyTo":"alpine.DEB.1.00.0902171630130.6185@intel-tinevez-2-302","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-02-17T15:39:33Z","receivedAt":"2009-02-17T15:39:33Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Johannes Schindelin wrote:\n> > unsigned int log2_integer_approximate(unsigned int n){\n[...]\n> That assumes that your floats are IEEE floats, right?\n\nFor extra weird code, you could the standard 5-line bit order inverter\nand apply ffs().\n\n;-)\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"105169","messageId":"alpine.DEB.1.00.0902171639060.6185@intel-tinevez-2-302","threadId":"17842","inReplyTo":"43d8ce650902170736h6316f987qc783edeebf488b40@mail.gmail.com","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-17T15:39:54Z","receivedAt":"2009-02-17T15:39:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 17 Feb 2009, John Tapsell wrote:\n\n> 2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>\n> > On Tue, 17 Feb 2009, John Tapsell wrote:\n> >\n> >> 2009/2/17 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> >>\n> >> > On Tue, 17 Feb 2009, Christian Couder wrote:\n> >> >\n> >> >> +static int estimate_bisect_steps(int all)\n> >> >> +{\n> >> >> +     int log2 = 0;\n> >> >> +     int left = (all >> 1) - 1;\n> >> >> +\n> >> >> +     if (left <= 0)\n> >> >> +             return 0;\n> >> >> +\n> >> >> +     do {\n> >> >> +             left = left >> 1;\n> >> >> +             log2++;\n> >> >> +     } while (left);\n> >> >> +\n> >> >> +     return log2;\n> >> >> +}\n> >> >\n> >> > How about this instead, calling it from cmd_rev_list directly?\n> >> >\n> >> >        static int log2(int n)\n> >> >        {\n> >> >                int log2;\n> >> >\n> >> >                for (log2 = 0; n > 1; log2++)\n> >> >                        n >>= 1;\n> >> >\n> >> >                return log2;\n> >> >        }\n> >>\n> >> This would work, if you want a non-iterative solution\n> >>\n> >> unsigned int log2_integer_approximate(unsigned int n){\n> >> *((float*)&n) = (float)n;\n> >> return ((n & (~((1<<23) - 1))) >> 23) - 127;\n> >> }\n> >\n> > That assumes that your floats are IEEE floats, right?\n> \n> Yeah.  Is it a bad assumption? Does git run on any system in which they \n> aren't?\n\nOnly when you are porting Git to embedded devices.\n\nDon't moan: there exists a git-daemon for iPhone.  Oh, wait!  /me \nscribbles that down for the UGFWIINI contest.\n\nCiao,\nDscho\n"},{"id":"105392","messageId":"200902190616.18747.chriscool@tuxfamily.org","threadId":"17842","inReplyTo":"7vljs58qul.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-02-19T05:16:18Z","receivedAt":"2009-02-19T05:16:18Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le mardi 17 février 2009, Junio C Hamano a écrit :\n> Christian Couder <chriscool@tuxfamily.org> writes:\n> > +static int estimate_bisect_steps(int all)\n> > +{\n> > +\tint log2 = 0;\n> > +\tint left = (all >> 1) - 1;\n> > +\n> > +\tif (left <= 0)\n> > +\t\treturn 0;\n> > +\n> > +\tdo {\n> > +\t\tleft = left >> 1;\n> > +\t\tlog2++;\n> > +\t} while (left);\n> > +\n> > +\treturn log2;\n> > +}\n> > ...\n> > diff --git a/git-bisect.sh b/git-bisect.sh\n> > index 85db4ba..6b23439 100755\n> > --- a/git-bisect.sh\n> > +++ b/git-bisect.sh\n> > @@ -500,7 +500,7 @@ bisect_next() {\n> >  \t# commit is also a \"skip\" commit (see above).\n> >  \texit_if_skipped_commits \"$bisect_rev\"\n> >\n> > -\tbisect_checkout \"$bisect_rev\" \"$bisect_nr revisions left to test\n> > after this\" +\tbisect_checkout \"$bisect_rev\" \"$bisect_nr revisions left\n> > to test after this (roughtly $bisect_steps steps)\"\n>\n> \"roughly\".\n\nYes, thanks.\n\n> all\tleft\n> 0\t0\n> 1\t0\n> 2\t0\n> 3\t0\n> 4\t1\n> 5\t1\n> 6\t2\n> 7\t2\n> 8\t2\n> 9\t2\n>\n> It seems that at the very low end the estimate is a bit too optimistic.\n> How about showing this number from the Porcelain only when $bisect_steps\n> is more than 2 (or all is more than 9)?\n\nI think it's more consistent to always show it.\n\nNow for the algorithm, first please note that we are looking for an estimate \nof the number of bisect steps left _after the current one_, and that git \nbisect currently only displays an estimate of the number of revisions left \nto test _after the current one_.\n\nHere is a table to help analyse what should be the best estimate for\nthe number of bisect steps left.\n\nN : linear case                    --> probabilities --> best | v1\n------------------------------------------------------------------\n1 : G-B                            --> 0             --> 0    | 0\n2 : G-U1-B                         --> 0             --> 0    | 0\n3 : G-U1-U2-B                      --> 0(1/3) 1(2/3) --> 1    | 0\n4 : G-U1-U2-U3-B                   --> 1             --> 1    | 1\n5 : G-U1-U2-U3-U4-B                --> 1(3/5) 2(2/5) --> 1    | 1\n6 : G-U1-U2-U3-U4-U5-B             --> 1(2/6) 2(4/6) --> 2    | 2\n7 : G-U1-U2-U3-U4-U5-U6-B          --> 1(1/7) 2(6/7) --> 2    | 2\n8 : G-U1-U2-U3-U4-U5-U6-U7-B       --> 2             --> 2    | 2\n9 : G-U1-U2-U3-U4-U5-U6-U7-U8-B    --> 2(7/9) 3(2/9) --> 2    | 2\n10: G-U1-U2-U3-U4-U5-U6-U7-U8-U9-B --> 2(6/10)3(4/10)--> 2    | 3\n\nIn the column \"N\", there is the number of revisions that could _now_\nbe the first bad commit we are looking for.\n\nThe \"linear case\" column describes the linear history corresponding to\nthe number in column N. G means good, B means bad, and Ux means\nunknown. Note that the first bad revision we are looking for can be\nany Ux or B.\n\nIn the \"probabilities\" column, there are the different outcomes in\nnumber of steps with the odds of each outcome in parenthesis\ncorresponding to the linear case.\n\nThe \"best\" column gives the most accurate estimate among the different\noutcomes in the \"probabilities\" column.\n\nThe \"v1\" column gives the estimates according my first patch.\n\nNow looking at the table, we have the following:\n\nbest(2^n) == n - 1\n\nand for any x between 0 included and 2^n excluded, the probability for\nn - 1 steps left looks like:\n\nP(2^n + x) == (2^n - x) / (2^n + x) \n\nIf P(2^n + x) < 0.5 we should return n and otherwise n - 1.\n\nBut P(2^n + x) < 0.5 means:\n\n2 * (2^n - x) < (2^n + x)\n\nthat is: 2^n < 3x\n\nSo the improved algorithm could be something like:\n\nstatic int estimate_bisect_steps(int all)\n{\n\tint n, x, e;\n\tfloat p;\n\n\tif (all < 3)\n\t\treturn 0;\n\n\tn = log2(all);\n\te = exp2(n);\n\tx = all - e;\n\n\treturn (e < 3 * x) ? n : n - 1 ;\n}\n\nBut on Linux, log2 and exp2 are defined in \"math.h\" and available with:\n\n_XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99\n\nand we must link with -lm, but I don't know about the other platforms.\n\nSo I don't know what to do about them. Please advise.\n\nThanks in advance,\nChristian.\n"},{"id":"105393","messageId":"200902190626.36163.chriscool@tuxfamily.org","threadId":"17842","inReplyTo":"200902190616.18747.chriscool@tuxfamily.org","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-02-19T05:26:35Z","receivedAt":"2009-02-19T05:26:35Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le jeudi 19 février 2009, Christian Couder a écrit :\n> So the improved algorithm could be something like:\n>\n> static int estimate_bisect_steps(int all)\n> {\n> \tint n, x, e;\n> \tfloat p;\n\nOops, the line above is not needed.\n\n> \tif (all < 3)\n> \t\treturn 0;\n>\n> \tn = log2(all);\n> \te = exp2(n);\n> \tx = all - e;\n>\n> \treturn (e < 3 * x) ? n : n - 1 ;\n> }\n"},{"id":"105394","messageId":"200902190632.50156.chriscool@tuxfamily.org","threadId":"17842","inReplyTo":"200902190616.18747.chriscool@tuxfamily.org","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-02-19T05:32:49Z","receivedAt":"2009-02-19T05:32:49Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le jeudi 19 février 2009, Christian Couder a écrit :\n>\n> But on Linux, log2 and exp2 are defined in \"math.h\" and available with:\n>\n> _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99\n>\n> and we must link with -lm, but I don't know about the other platforms.\n>\n> So I don't know what to do about them. Please advise.\n\nWhat I mean is that log2 is just something like:\n\nint log2 = 0;\n\nfor (; n > 1; n >>= 1)\n\tlog2++;\n\nand exp2 is just \"1 << n\", so I wonder if it's really necessary to add a lot \nof stuff in the Makefile for these 2 really short functions.\n\nRegards,\nChristian.\n"},{"id":"105395","messageId":"43d8ce650902182202s4c06a261jd68a2f86607f00ef@mail.gmail.com","threadId":"17842","inReplyTo":"200902190632.50156.chriscool@tuxfamily.org","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2009-02-19T06:02:09Z","receivedAt":"2009-02-19T06:02:09Z","isPatch":true,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"2009/2/19 Christian Couder <chriscool@tuxfamily.org>:\n> Le jeudi 19 février 2009, Christian Couder a écrit :\n>>\n>> But on Linux, log2 and exp2 are defined in \"math.h\" and available with:\n\nlog2 in math.h is for doubles, when we only want an integer answer.\nThere's no need for math.h here.\n"},{"id":"105397","messageId":"200902190749.19414.chriscool@tuxfamily.org","threadId":"17842","inReplyTo":"43d8ce650902182202s4c06a261jd68a2f86607f00ef@mail.gmail.com","subject":"Re: [PATCH] rev-list: estimate number of bisection step left","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-02-19T06:49:18Z","receivedAt":"2009-02-19T06:49:18Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le jeudi 19 février 2009, John Tapsell a écrit :\n> 2009/2/19 Christian Couder <chriscool@tuxfamily.org>:\n> > Le jeudi 19 février 2009, Christian Couder a écrit :\n> >> But on Linux, log2 and exp2 are defined in \"math.h\" and available\n> >> with:\n>\n> log2 in math.h is for doubles, when we only want an integer answer.\n> There's no need for math.h here.\n\nYeah, you are right. Sorry about the noise. I will send a patch soon.\n\nThanks,\nChristian.\n"}]}