Hi Rasmus, On Tue, 4 Mar 2025 at 11:55, Rasmus Villemoes <[email protected]> wrote: > > On Tue, Mar 04 2025, Simon Glass <[email protected]> wrote: > > > Hi Rasmus, > > > > On Fri, 18 Oct 2024 at 08:55, Simon Glass <[email protected]> wrote: > >> > >> Hi Rasmus, > >> > >> On Fri, 18 Oct 2024 at 01:05, Rasmus Villemoes <[email protected]> wrote: > >> > > >> > On tor, okt 17 2024, Simon Glass <[email protected]> wrote: > >> > > >> > > > >> > > membuf: Support a flag for being full > >> > > > >> > > >> > No, that is the worst of all worlds, especially with it being a > >> > build-time flag. The right implementation is the one where the head and > >> > tail indices are free-running, where you get such a "flag" for > >> > free, because you're not wasting the top bits of the indices. > >> > > >> > https://www.snellman.net/blog/archive/2016-12-13-ring-buffers/ > >> > >> > > >> > If you want to do the churn of renaming anyway, I suggest doing it by > >> > adding an implementation using the proper scheme under the new name, > >> > switch users over, and dropping the old. IMO, this series as-is brings > >> > no value (except for the tests, of course). > >> > >> OK. Do you think this series gets us closer to that, or further away? > > > > I didn't get a response to this (which is not a problem, I miss things > > all the time). Anyway I don't like the power-of-two restriction and > > you can see my other responses above. I've applied this to my tree as > > I want to have the tests in place. > > I stand by my earlier comments that this is the wrong way to implement a > circular buffer. I hope Tom doesn't pull this.
OK. Are you saying that you think it should only support power-of-two sizes, or something else? What specifically do you want? This series: - adds tests - renames to membuf - shows how we could switch to using an empty/full flag instead of leaving an empty slot, so we can see the code-size image - does all this without requiring the size to be a power of two (which limits its usefulness IMO) Regards, Simon

