mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
GetBit for IdentHash
This commit is contained in:
parent
7b632bd03d
commit
4d0ad47491
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2022, The PurpleI2P Project
|
* Copyright (c) 2013-2023, The PurpleI2P Project
|
||||||
*
|
*
|
||||||
* This file is part of Purple i2pd project and licensed under BSD3
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
@ -80,6 +80,13 @@ namespace data {
|
|||||||
return i2p::data::Base64ToByteStream (s.c_str (), s.length (), m_Buf, sz);
|
return i2p::data::Base64ToByteStream (s.c_str (), s.length (), m_Buf, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t GetBit (int i) const
|
||||||
|
{
|
||||||
|
int pos = i >> 3; // /8
|
||||||
|
if (pos >= sz) return 0;
|
||||||
|
return m_Buf[pos] & (1 << (7 - (i & 0x07)));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
union // 8 bytes aligned
|
union // 8 bytes aligned
|
||||||
|
Loading…
Reference in New Issue
Block a user