Skip to content

Conversation

@idevtm
Copy link

@idevtm idevtm commented May 19, 2025

This is meant to work around the situation when absl::bit_width is unsigned long.

error: no matching function for call to 'max'
[build]   return max(61 - absl::bit_width(bits), -1) >> 1;
[build]          ^~~
[build] /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/algorithmfwd.h:407:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long' vs. 'int')

ref abseil/abseil-cpp#1890
ref #421 (comment)

System: Debian 12
Compiler: Clang-15

@idevtm idevtm marked this pull request as ready for review May 19, 2025 15:57
@jmr jmr changed the title Fix type conversion in GetCommonAncestorLevel for bit width calculation GetCommonAncestorLevel: work around bit_width return type bug May 19, 2025
jmr added 2 commits May 19, 2025 21:09
Add comment to document workaround.

Move cast.  It's the `bit_width` return value that is wrong, so cast that.
@jmr jmr merged commit 473a989 into google:master May 20, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants