HomePhabricator

Merge #14510: Avoid triggering undefined behaviour in base_uint<BITS>::bits()

Description

Merge #14510: Avoid triggering undefined behaviour in base_uint<BITS>::bits()

Summary:
PR14510 backport https://github.com/bitcoin/bitcoin/pull/14510/files
96f6dc9fc50b1cc59e26d50940ebf46e1bdcc0ba Avoid triggering undefined behaviour in base_uint<BITS>::bits() (practicalswift)

Pull request description:

Avoid triggering undefined behaviour in `base_uint<BITS>::bits()`.

`1 << 31` is undefined behaviour in C++11.

Given the reasonable assumption of `sizeof(int) * CHAR_BIT == 32`.

Test Plan: make check

Reviewers: Fabien, #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D3126

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on May 27 2019, 15:00
Mark Lundeberg <36528214+markblundeberg@users.noreply.github.com>Committed on May 27 2019, 15:00
MengerianPushed on May 27 2019, 15:23
Reviewer
Restricted Project
Differential Revision
D3126: Merge #14510: Avoid triggering undefined behaviour in base_uint<BITS>::bits()
Parents
rSTAGING9c76f4564b0b: Update prevector
Branches
Unknown
Tags
Unknown