Skip to content

Comments

Fix narrowing conversion error#3

Open
jmr wants to merge 1 commit intomigumar2:masterfrom
jmr:fix-narrowing
Open

Fix narrowing conversion error#3
jmr wants to merge 1 commit intomigumar2:masterfrom
jmr:fix-narrowing

Conversation

@jmr
Copy link

@jmr jmr commented Apr 25, 2022

Fixes #2.

Explicitly cast values to DTsucc to avoid error:

static/suffixtree/RMQ_succinct.cpp:115:85: error: narrowing conversion of ‘-1’ from ‘int’ to ‘DTsucc {aka unsigned char}’ inside { } [-Wnarrowing]
  const DTsucc RMQ_succinct::HighestBitsSet[8] = {~0, ~1, ~3, ~7, ~15, ~31, ~63, ~127};

This appears to be an error in C++11 and newer, which is typically
the default mode these days.

Fixes migumar2#2.

Explicitly cast values to `DTsucc` to avoid error:
```
static/suffixtree/RMQ_succinct.cpp:115:85: error: narrowing conversion of ‘-1’ from ‘int’ to ‘DTsucc {aka unsigned char}’ inside { } [-Wnarrowing]
  const DTsucc RMQ_succinct::HighestBitsSet[8] = {~0, ~1, ~3, ~7, ~15, ~31, ~63, ~127};
```

This appears to be an error in C++11 and newer, which is typically
the default mode these days.
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.

Problems compiling the libcds

1 participant