> -----Original Message-----
> From: Kevin.Lewis@stripped [mailto:Kevin.Lewis@stripped]
> Sent: Thursday, January 22, 2009 9:37 AM
> To: Vladislav Vaintroub
> Cc: commits@stripped
> Subject: Re: bzr commit into mysql-6.0-falcon-team branch
> (vvaintroub:2965) Bug#42136
>
> This code is not good. See comments inline;
Kevin,
I propose you run this standalone program, that calculates the length
exactly as I did in my patch and verify that it corresponds to what you
think is correct.
#include <stdio.h>
int main( int argc, char **argv)
{
#define RUN 6
#define ROUNDUP(n,b) ((((n) + (b) - 1) /(b) ) * (b))
int i;
printf("len last non_last\n");
for(i=0; i < 20; i++)
{
int segmentLengthLast = i + i/RUN + 1;
int segmentLengthNonLast = ROUNDUP(segmentLengthLast, RUN);
printf("%3d %10d %10d\n", i, segmentLengthLast,
segmentLengthNonLast);
}
}