News for hackers. Stuff that matters.
Re:Fast midpoint between two integers without overflow by zmgsabst on Wednesday December 07, 2022 @03:14PM (#33899615)
You probably want i=1 since i=0 is an answer you can predict:

i = 0 implies that i = 0 + 0 = 0; so the loop doesn’t evolve, and the whole thing can be optimized to just i = 0.

For i=1, the loop simplifies to 2^count and a count-length type, which is the point I think you wanted.

Re:Fast midpoint between two integers without overflow by munificent on Thursday December 08, 2022 @12:56PM (#33910895)
Heh, oops, yes. :)