| Kevin Ryde on Thu, 20 Jan 2022 01:13:38 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: forbidden comparison |
"Ruud H.G. van Tol" <rvtol@isolution.nl> writes: > > my( v= 23, c3= 7); > \\ ... > my( c= c3 * 2 ); while( c < v, c3= c; c*= 2 ); \\un-oddify > What are alternative ways to do such? Logs can give you k shift either right or 1 too big, and compare to see which. k = logint(v,2) - logint(c3,2) c3 <<= k; if(c3 >= v, c3>>=1)