Skip to content
Snippets Groups Projects
Commit 05eb181b authored by kaldoran's avatar kaldoran Committed by Simon Désaulniers
Browse files

Pht : Fix out of range in isActiveBit function

parent c08333f2
No related branches found
No related tags found
No related merge requests found
......@@ -52,8 +52,12 @@ struct Prefix {
* @param pos : Pos of the needed bit
* @return : true if the bit is at 1
* false otherwise
* @throw out_of_range Throw out of range if the bit at 'pos' does not exist
*/
bool isActiveBit(size_t pos) const {
if ( pos >= size_ )
throw std::out_of_range("Can't detect active bit at pos, pos larger than prefix size or empty prefix");
return ((this->content_[pos / 8] >> (7 - (pos % 8)) ) & 1) == 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment