This is an archive of the discontinued LLVM Phabricator instance.

[Support] Generic wrapper over __builtin_clz with cross-platform fallback
AbandonedPublic

Authored by nand on Aug 31 2019, 1:41 PM.

Details

Summary

Added CountLeadingZeros<T> for signed and unsigned types to count the number
of leading zeros. On platforms with __builtin_clz, the builtin is used, otherwise
a generic fallback is provided. Unlike __builtin_clz, the method returns the
bit width of the type for 0.

Event Timeline

nand created this revision.Aug 31 2019, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2019, 1:41 PM
nand edited the summary of this revision. (Show Details)Aug 31 2019, 1:42 PM
nand edited the summary of this revision. (Show Details)Aug 31 2019, 1:42 PM
nand abandoned this revision.Aug 31 2019, 1:49 PM