diff --git a/autotest/SignificantBits/SignificantBits.cpp b/autotest/SignificantBits/SignificantBits.cpp new file mode 100644 index 000000000..9199edcb0 --- /dev/null +++ b/autotest/SignificantBits/SignificantBits.cpp @@ -0,0 +1,21 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + for(int i = -1; i < 64; i++) { + uint64 v = i >= 0 ? (uint64)1 << i : 0; + LOG("==============="); + DUMPHEX(v); + DUMP(SignificantBits64(v)); + DUMP(SignificantBits(v)); + if(i < 32) + ASSERT(SignificantBits((dword)v) == i + 1); + ASSERT(SignificantBits64(v) == i + 1); + } + + LOG("================= OK"); +} diff --git a/autotest/SignificantBits/SignificantBits.upp b/autotest/SignificantBits/SignificantBits.upp new file mode 100644 index 000000000..887ea4bea --- /dev/null +++ b/autotest/SignificantBits/SignificantBits.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + SignificantBits.cpp; + +mainconfig + "" = ""; +