MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / log2_rec

Function log2_rec

smt/expr.cpp:1043–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1041}
1042
1043static expr log2_rec(const expr &e, unsigned idx, unsigned bw) {
1044 if (idx == 0)
1045 return expr::mkUInt(0, bw);
1046
1047 return expr::mkIf(e.extract(idx, idx) == 1,
1048 expr::mkUInt(idx, bw),
1049 log2_rec(e, idx - 1, bw));
1050}
1051
1052expr expr::isPowerOf2() const {
1053 return *this != 0 && (*this & (*this - mkUInt(1, *this))) == 0;

Callers 1

log2Method · 0.85

Calls 1

extractMethod · 0.45

Tested by

no test coverage detected