Re: [PATCH] expand the units that pg_size_pretty supports on output
От | Dean Rasheed |
---|---|
Тема | Re: [PATCH] expand the units that pg_size_pretty supports on output |
Дата | |
Msg-id | CAEZATCWgQgSEU_vpVbxdruqJnhiN8X57GC6x83SyAEUhkVFmYw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH] expand the units that pg_size_pretty supports on output (David Rowley <dgrowleyml@gmail.com>) |
Ответы |
Re: [PATCH] expand the units that pg_size_pretty supports on output
|
Список | pgsql-hackers |
On Tue, 6 Jul 2021 at 10:20, David Rowley <dgrowleyml@gmail.com> wrote: > > I made another pass over this and ended up removing the doHalfRound > field in favour of just doing rounding based on the previous > bitshifts. > When I first read this: + /* half-round until we get down to unitBits */ + while (rightshifts++ < unit->unitBits) + size = half_rounded(size); it looked to me like it would be invoking half_rounded() multiple times, which raised alarm bells because that would risk rounding the wrong way. Eventually I realised that by the time it reaches that, rightshifts will always equal unit->unitBits or unit->unitBits - 1, so it'll never do more than one half-round, which is important. So perhaps using doHalfRound would be clearer, but it could just be a local variable tracking whether or not it's the first time through the loop. Regards, Dean
В списке pgsql-hackers по дате отправления: