Message ID | 87obmwuufj.fsf@redhat.com |
---|---|
State | New |
Headers | show |
Ok.
Index: libgcc/config/m32c/lib2funcs.c =================================================================== --- libgcc/config/m32c/lib2funcs.c (revision 189996) +++ libgcc/config/m32c/lib2funcs.c (working copy) @@ -132,3 +132,17 @@ { return udivmodsi4 (a, b, 1); } + +/* Returns the number of leading redundant sign bits in X. + I.e. the number of bits following the most significant bit which are + identical to it. There are no special cases for 0 or other values. */ + +int +__clrsbhi2 (word_type x) +{ + if (x < 0) + x = ~x; + if (x == 0) + return 15; + return __builtin_clz (x) - 1; +}