I have a feeling that if we add all methods from my bithelpers to standard types then it would be overcrowded. I don't mind doing it, but although bit manipulation is very important - out of embedded world it is actually not used that often to justify it's place in standard type default helpers, so I would prefer to see it in a separate FPC package and just add bithelpers unit to uses code section when needed. What do you think?
Well, several points:
-
I wrote that code with some great feedback and tests by Bart, but I should probably also write a request for documentation (and a proposal documentation to go with it)
- Apart from embedded, it is is useful in several ways, especially Database application, e.g. SQL is based on bit tables and it is highly useful for AI as well. (schuler likes your code not for nothing)
- I wrote it initially because I needed it for electronics on Raspberry Pi and the likes.
- I still think we should avoid overlaps, but lets discuss just the candidates that really warrant inclusion in my four.
In latest update I have also moved away from standard SHL based bit getting/setting to precalculated BitValueLookupTable[] for speed optimization, but did not make any benchmarks yet to see if there was actual benefit (SHL should be very fast in modern processors). Patches should be made only after benchmarking decision.
I agree. Note I have some updates for implemention of ROL/ROR SAR etc, which is also useful.
About speed: that is indeed highly CPU dependent. Lets come up with some tests.
I really appreciate your contribution! It is a nice library.