Boost logo

Boost Users :

From: degski (degski_at_[hidden])
Date: 2019-07-12 04:38:01


On Thu, 11 Jul 2019 at 22:15, Neill Clift via Boost-users <
boost-users_at_[hidden]> wrote:

> I use the same sort of logic to calculate Floor(Log2(n)) (number of
> largest bit set), to clear the bottom say b bits of an integer.
>
> Is this a reasonable (though probably not idea) way to go?
>

Iff you're gonna fiddle with the limbs anyway, why not just set the bits to
zero, directly.

> I noted that the limbs are 32 bits on Windows and this leads me to my
> second question. How can I get the internals of boost using bigger chunks
> like 64 bit?
>

You'll have to compile the code for 64-bits (x64), then you'll get 64-bit
limbs.

It seems I need a compiler supporting __int64.
>

 You should use the std-types std::int64_t and std::uint64_t (#include
<cstdint>).

I tried LLVM but that seemed quite slow. I may not have put enough effort
> into investigating LLVM up to this point.
>

Clang/LLVM (and gcc) has a builtin type (in 64-bit mode only) as an
extension __uint128_t (pass (-Xclang) -fforce-enable-int128).

degski

-- 
@realdegski
https://edition.cnn.com/interactive/2019/06/middleeast/saudi-teen-death-penalty-intl/
"Anyone who believes that exponential growth can go on forever in a finite
world is either a madman or an economist" - Kenneth E. Boulding


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net