]> www.ginac.de Git - cln.git/blob - tests/test_I_power2p.cc
Remove the conversion step .tex -> .texi.
[cln.git] / tests / test_I_power2p.cc
1 #include "test_I.h"
2
3 int test_I_power2p (int iterations)
4 {
5         int error = 0;
6         int i;
7         // Check powers of 2.
8         for (i = iterations; i > 0; i--) {
9                 uintL n = random32() % 1024;
10                 cl_I a = ash(1,n);
11                 ASSERT1(power2p(a) == n+1, n);
12         }
13         // Check against logcount.
14         for (i = iterations; i > 0; i--) {
15                 cl_I a = testrandom_I();
16                 if (a > 0)
17                         ASSERT1(power2p(a) == (logcount(a) == 1 ? integer_length(a) : 0), a);
18         }
19         return error;
20 }