2**31-1 = 1, 2**31-2 = 0 mod 3
0: 715827883
1: 715827883
2: 715827882
(rand() * range) >> 32
__uint128
#if !defined(_MSC_VER) || _MSC_VER >= 1600
#include <stdint.h>
#else
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#endif
typedef __uint128 uint128
if you wanted totypedef __int128 int128
__int128
is signd and __uint128
is unsignedstd::vector<bool>
which is oddly enough a bitset because someone had too much to drink before they made it to the standards committee meetingDWORD64
sULARGE_INTEGER
s in a struct now that would be truly horrendousPeople should follow standards. Microsoft is the standard. And the circle is complete. – Bruce Zenone May 7 '14 at 21:45
PRIx64
QuadroMask(long long mask) {
memset(m_Mask, mask, sizeof(m_Mask));
}
int64_t m_Mask[2];
now, so what to pass here?
bool IsSet(size_t BitIndex) const {
size_t IndexOfBit = BitIndex / (sizeof(int64_t) * 8);
size_t BitInIndex = BitIndex % (sizeof(int64_t) * 8);
return (operator[](IndexOfBit) & (((int64_t)1) << BitInIndex)) != 0;
}
int64_t operator & (const Mask128& Mask)
{
return (m_Mask[0] & Mask[0]) | (m_Mask[1] & Mask[1]);
}
std::bitset
sizeof(int64_t) * 8
is a power of 2
...thoughcode
``` for
multi
line
body {
background-color: #0080FF;
}
<c++>
int i(void);
c++
int i(void);
c++
void test(int a, int b)
{
return;
}
return __shiftright128(m_Data[0], m_Data[1], idx) & 1;
works great for msvcstd::bitset<128>
is mediocre across all relevant compilers