This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Using GMP for BigIntegers.
"Mark J. Roberts" <mjr@statesmean.com> writes:
> You use Java's unsigned right shift operator (>>> and >>>=) about 12 times
> in your code. How should I translate this to C++?
You can use a regular shift, as long as the operand is unsigned.
You can cast the operand, if need be. (Make sure that >> in the
Java code is also signed shift or that it doesn't matter.)
> Also,
> rshift (jintArray idest, jintArray ix, jint x_start, jint len, jint count)
> and
> lshift (jintArray idest, jint d_offset, jintArray ix, jint len, jint count)
> don't have GMP counterparts AFAIK.
Use pointer addition:
mpn_rshift(elements(idest), elements(ix)+x_start, len, count)
mpn_lshift(elements(idest)+d_offset, elements(ix), len, count)
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/