3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-19 09:40:20 +00:00

checkpoint

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-10-21 13:32:12 -07:00
parent 4722fdfca5
commit add684d8e9
377 changed files with 204 additions and 62 deletions

33
src/util/luby.cpp Normal file
View file

@ -0,0 +1,33 @@
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
luby.cpp
Abstract:
<abstract>
Author:
Leonardo de Moura (leonardo) 2008-03-04.
Revision History:
--*/
#include<cmath>
unsigned get_luby(unsigned i) {
if (i == 1)
return 1;
double k = log(static_cast<double>(i+1))/log(static_cast<double>(2));
if (k == floor(k + 0.5))
return static_cast<unsigned>(pow(2,k-1));
else {
k = static_cast<unsigned>(floor(k));
return get_luby(i - static_cast<unsigned>(pow(2, k)) + 1);
}
}