streams: Implement BitStreamReader/Writer classes.
Summary:
Golomb-Rice coding, as specified in BIP 158, involves operations on
individual bits. These classes will be used to implement the
encoding/decoding operations.
For BIP158; is cherry-picked from two commits (fe943f9 and 9b622dc) from:
https://github.com/bitcoin/bitcoin/pull/12254/commits
Depends on D2797.
Test Plan: make check
Reviewers: #bitcoin_abc, deadalnix, Fabien
Reviewed By: #bitcoin_abc, deadalnix, Fabien
Subscribers: Fabien
Maniphest Tasks: T589
Differential Revision: https://reviews.bitcoinabc.org/D2799