File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,13 @@ namespace inclusion_ccd
4545 // }
4646
4747 // calculate a*(2^b)
48- long power (const long a, const int b) { return a << b; }
48+ long power (const long a, const int b)
49+ {
50+ // The fast bit shifting power trick only works if b is not too larger.
51+ assert (b < 8 * sizeof (long ) - 1 );
52+ // WARNING: Technically this can still fail with `b < 8 * sizeof(long) - 1` if `a > 1`.
53+ return a << b;
54+ }
4955 std::array<Scalar, 8 > function_ee (
5056 const Scalar &a0s,
5157 const Scalar &a1s,
Original file line number Diff line number Diff line change @@ -1942,7 +1942,7 @@ namespace inclusion_ccd
19421942 rnbr++;
19431943 // continue;
19441944 toi = Numccd2double (TOI) * impact_ratio;
1945- // std::cout << "return 1" << std::endl;
1945+ // std::cout << "return 1" << std::endl;
19461946 return true ;
19471947 // we don't need to compare with TOI_SKIP because we already continue
19481948 // when t>=TOI_SKIP
@@ -2384,7 +2384,7 @@ namespace inclusion_ccd
23842384 vffilter = 6.661338147750939e-15 ;
23852385#else
23862386 eefilter = 3.337861e-06 ;
2387- vffilter = 3.576279e-06 ;
2387+ vffilter = 3.576279e-06 ;
23882388#endif
23892389 }
23902390 else // using minimum separation
@@ -2393,7 +2393,7 @@ namespace inclusion_ccd
23932393 eefilter = 7.105427357601002e-15 ;
23942394 vffilter = 7.549516567451064e-15 ;
23952395#else
2396- eefilter = 3.814698e-06 ;
2396+ eefilter = 3.814698e-06 ;
23972397 vffilter = 4.053116e-06 ;
23982398#endif
23992399 }
You can’t perform that action at this time.
0 commit comments