summaryrefslogtreecommitdiffstats
path: root/clang/test/Misc/pragma-attribute-supported-attributes-list.test
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-04-19 15:45:31 +0000
committerZachary Turner <zturner@google.com>2017-04-19 15:45:31 +0000
commitf19b0c7f6be6928cbea4f8681b99a259519138f2 (patch)
tree4fb401aae3f76df4a65fd33b360706563a0d284e /clang/test/Misc/pragma-attribute-supported-attributes-list.test
parent13c0c12b66ed6d36ceebc819a1798ff471e60768 (diff)
downloadbcm5719-llvm-f19b0c7f6be6928cbea4f8681b99a259519138f2.tar.gz
bcm5719-llvm-f19b0c7f6be6928cbea4f8681b99a259519138f2.zip
[Support] Add some helpers to generate bitmasks.
Frequently you you want a bitmask consisting of a specified number of 1s, either at the beginning or end of a word. The naive way to do this is to write template<typename T> T leadingBitMask(unsigned N) { return (T(1) << N) - 1; } but using this function you cannot produce a word with every bit set to 1 (i.e. leadingBitMask<uint8_t>(8)) because left shift is undefined when N is greater than or equal to the number of bits in the word. This patch provides an efficient, branch-free implementation that works for all values of N in [0, CHAR_BIT*sizeof(T)] Differential Revision: https://reviews.llvm.org/D32212 llvm-svn: 300710
Diffstat (limited to 'clang/test/Misc/pragma-attribute-supported-attributes-list.test')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud