reverted 18e97f6dd5457538c7bf39c6abcf346f5a080ca5#310
reverted 18e97f6dd5457538c7bf39c6abcf346f5a080ca5#310OlegHahm merged 1 commit intoRIOT-OS:masterfrom
Conversation
|
on what platform? |
|
msp430 |
|
but reverting this adds problems for the posix layer.... I think this is our case: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34210 can we implement |
|
@mehlis Without having looked too far into this (only at your link actually) I guess this would mean patching gcc... we don't want to do that. |
|
isn't it possible to have something like this for the msp430 perhaps |
|
I think we shouldn't rely on any compiler builtins as GCC might not be available for all platforms. We could define a ffs for MSP430 ourselves. |
|
@mehlis, no luck: "undefined reference to `__clzhi2'" |
|
I could offer an O(log CHAR_BIT) implementation instead of the "naïve" implementation for ffs/number_of_lowest_bit: https://gist.github.com/Kijewski/7359805. Maybe being used in the scheduler could justify a more complex solution in favor of speed? On my home x86 my implementation takes 29s to calculate ffs(u) for u in [0, 2^32). With arm-none-eabi-gcc -Os the
|
|
@mehlis the posix wrapper does not rely on it. We could easily replace ffs (which is not dependent on this commit btw) by our own implementation. |
|
@Kijewski, I haven't tested on the MSP430, but on ARM7 your code is - as mentioned - slower (with -Os and -O0). I didn't quite get how you would make it smaller with |
Darn. Now I see why I had to abort my test. If you supply number_of_lowest_bit with a zero it gets stuck …
You only need ffs or clz, not both, b/c clz can emulate ffs. |
As the documentation says. So, we continue with the old implementation? If there is something more efficient I'd be happy to use it. |
Documenting a problem is one step short of fixing a problem. :) But I guess reverting the commit is not the best approach. Why not just implement __ffshi2 for MSP 430? (And Why is the folder called msb-430 if the hardware is called msp-430?) |
You cannot do all kind of error handling on constrained devices, you have to rely on the programmer knowing what he's doing.
Well, that's basically what bitarithm does.
Don't mix up things: The MSB-430 (modular sensor board) is a hardware platform developed at FU Berlin: |
|
So, what's the conclusion? |
|
needs rebase |
|
Done |
|
ACK |
|
@OlegHahm merge? |
|
Merge |
ffs produces