# [Wise], 40 bytes

    ::^?[:::^~-&[-~!~-~-?]!-~?|>]|:[>-?>?]|~

[Try it online!][TIO-j52k78lz]

[Wise]: https://github.com/Wheatwizard/Wise
[TIO-j52k78lz]: https://tio.run/##K88sTv3/38oqzj7aCkjW6apF69Yp1unW6drHKurW2dfYxdZYRdvp2tvZx9bU/f//38jQxNzEwtjMxAIA "Wise – Try It Online"

## Explanation

    ::^?                                      Put a zero on the bottom
        [                                     While
         :::^~-&                              Get the last bit
                [-~!~-~-?]!-~?|               Increment counter if 1 decrement if 0
                               >              Remove the last bit
                                ]|            End while
                                  :[>-?>?]|~  Get the sign